502 Gateway error

290 views
Skip to first unread message

whiteapple

unread,
Jul 6, 2016, 4:52:21 AM7/6/16
to spray.io User List
I am trying to send a HTTP request to spray server.

and intermittently/ or arbitrary it works sometimes and then it starts failing. till we restart.

Any suggestion to diagnose this issue will be helpful

Jan-Pieter van den Heuvel

unread,
Jul 6, 2016, 5:24:01 AM7/6/16
to spray...@googlegroups.com
Hi,

Spray itself does not return a 502 response; it is probably returned by some intermediate proxy (e.g. nginx). First verify that the spray server is actually unreachable when you receive the 502 response to exclude a problem in the proxy configuration. If it is indeed unreachable you have to determine why. There are lots of different reasons why a server could be unreachable. Is it still running or has the JVM crashed? Is it overloaded (high load on the server)? Are there other applications trying to listen on the same port? Or something else... One common mistake is to perform blocking calls such as querying a database inside the routing which will make the server unreachable during that request.

Hope this helps.

Kind regards,
Jan-Pieter

--
You received this message because you are subscribed to the Google Groups "spray.io User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spray-user+...@googlegroups.com.
Visit this group at https://groups.google.com/group/spray-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/spray-user/217cb085-81f4-4c6b-a5c7-127ad6212271%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

whiteapple

unread,
Jul 6, 2016, 7:25:55 AM7/6/16
to spray.io User List

spray server becomes reachable once client receives 502 error. Spray server works properly everytime when request is send by postman.
Once we send request from java program this issue happens. 

Jan-Pieter van den Heuvel

unread,
Jul 6, 2016, 4:52:01 PM7/6/16
to spray...@googlegroups.com
Then I would suggest looking at the difference between the requests to see why this results in different behaviour. The logRequest directive might be useful for that.

Reply all
Reply to author
Forward
0 new messages