Categories
WordPress

Mod JK Default Timeout of 45 Seconds Causes Bad Gateway Response

The architecture was almost standard: Apache 2.2 with mod_jk 1.2.8 and few Tomcats. The problem was users got a lot of 502 Bad Gateway from Apache after a wait of 45 seconds. I knew that some Tomact services were very long and it was acceptable to wait more than 45 seconds to get a response.

Mod_jk documentation reports a timeout between data packet (and so I believe before the first data packet too) of zero, unlimited. But after 45 seconds the connection dropped.

At the first we thought about Apache timeout that was set to 30 seconds, and we raised it to 120 seconds: nothing, still those mysterious 45 seconds…

So, despite the mod_jk documentation, we set the

worker.tomcat2.reply_timeout

to 300000 (300 seconds) and the 45 second time limit disappeared. Good to know, default value on mod_jk 1.2.8 seems to be 45 seconds and not zero.

May be it will be of any help to others!

By the way, the 120 timeout of Apache seems to be ignored when the request is managed by mod_jk.

Leave a Reply