502 Proxy error - play 2.1.0 prod with apache 2.2 reverse proxy

361 views
Skip to first unread message

Raj K

unread,
Feb 10, 2014, 1:57:22 PM2/10/14
to play-fr...@googlegroups.com
Hi,

Config
----------
We have a play 2.1.0 with angularjs setup in a production mode. 
We have reverse proxy load balancer setup with apache 2.2 something like mentioned in here

Problem
------------
This whole app is running in an iframe inside navigated from a jboss application.

Most of the time it works and sometimes when the connection is left idle for 2/3 hours, untouched, no one hit the reverse proxy url to load the jboss/play, then we are getting the 502 proxy error in the iframe content after a few mins wait.
Play receives the request, but somehow decides not to respond at all. This occurs only for the first time or couple of time after the wakeup. Then when we refresh the page play receives the request and responds it properly. 

Tried
-------
We get a tcpdump on the play port and it we have got all the requests being received, but no response sent from play for the failed scenario. Whereas the same request got responded by play subsequent times.

X-Forwarded-For: ,X-Forwarded-Host:  X-Forwarded-Server: .. Connection: Keep-Alive  - all these headers are being sent in the lost response tcpdump.

Tried KeepAlive, with timeouts in the proxy server, not much help. Why the play didn't respond for the initial connections after idle state, is there any conf I can set to keep it alive?

Any help would be really appreciated.


Thanks

Raj



Jun Yamog

unread,
Feb 10, 2014, 2:06:29 PM2/10/14
to play-framework
Hi,

We have a similar setup on prod, w/o iframes though.  We haven't encountered this issue.  Try to see if its the db layer that is not waking up properly.  Maybe just create 1 controller call that does a "def test = Action(Ok)".  Just to isolate which is the issue and get angular to just ping that test action.

Jun


--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Raj K

unread,
Feb 10, 2014, 2:14:10 PM2/10/14
to play-fr...@googlegroups.com
Thanks for the quick reply Jun.

Service layer is in apache karaf deployed separately and we haven't noticed any timeout issues on the other applications with karaf.

Also I'm no scala expert and if possible if you could suggest that piece in Java it will be helpful.

Raj

Jun Yamog

unread,
Feb 10, 2014, 2:31:19 PM2/10/14
to play-framework
Just try to isolate the issue.  You can just use the basic java controller.

public static Result index() {
        return ok("It works!");
    }
The maybe add some logging on it.  If you are able to replicate it on a test environment even better.  As you can try to attach a debugger and may get a better idea whats is happening.

Sorry can't help much.  I would like to know if you are able to know what is causing it.  We have a similar setup and maybe we haven't just encountered it.

Jun

Raj K

unread,
Feb 18, 2014, 4:44:13 PM2/18/14
to play-fr...@googlegroups.com
Tried with a sample application with test controller as suggested but not able to reproduce the issue. 

Polling the play server url constantly every half an hour from the same server makes this issue not reproducible. Right now we are having this workaround.

Any help or suggestion would be really helpful.


Raj

Jun Yamog

unread,
Feb 18, 2014, 7:02:51 PM2/18/14
to play-framework
Seems to be some kind of external resource (db, etc) to play not keeping the connection alive.  So it dies down and the initial request that it needs the external resource play tries it but unsuccessful to get back before the reverse proxy times out.

So the polling keeps the connection alive.  Maybe try to add a simple test code that depends on an external resource one at the time controller (process of elimination).  Is there no interesting on the log?  Or maybe a failed future is somehow getting swallowed?

Jun
Reply all
Reply to author
Forward
0 new messages