Archived Support Site

This support site is archived. You can view the old support discussions but you cannot post new discussions.

502 Bad Gateway

joelmartinez's Avatar

joelmartinez

07 Feb, 2011 04:02 PM

So I'm working on exposing this oData service on my site, which is hosted on AppHarbor. Now, something a little odd is happening. When accessed via the browser by passing in url parameters, the oData service response as expected ... example here:
http://p2plendingdata.com/lendingclubodata.svc/vNoteDetails()?$top=10

However, when I access it via one of several oData consumers (http://www.odata.org/consumers), I'm getting the following error:

"502 Bad Gateway
nginx/0.8.54"

So far, I've tried LinqPad, oData Explorer, and PowerPivot for Excel. I've also tried it from home and from work to rule out any location specific proxy issues. It would seem to suggest an issue with nginx ... though I'm not sure really where to start looking. I did a few searches and saw more than one reference to an issue with nginx and the fastcgi process. One example here:
http://premium.wpmudev.org/forums/topic/nginx-502-bad-gateway-errors

Let me know if there are any changes I could try on the code-side ... but I don't believe it's an issue with the wcf data service I'm exposing.

  1. Support Staff 1 Posted by rune on 07 Feb, 2011 07:04 PM

    rune's Avatar

    Hi Joel,

    I think the queries are not the ones you expect them to be when using various consumers. I tried OData explorer to consume your service and was able to make the query trough that. To do that I used http://p2plendingdata.com/lendingclubodata.svc/ as the Data Service Uri. Then I inserted the query /vNoteDetails()?$top=10 in the query field and clicked "Go".

    I did however run into the 502 issue when I clicked directly on the vNoteDetails collection in UI. It seems like you have a very large vNoteDetails collection and there are simply more data than the OData service can handle in a single response. Nginx returns a 502 because the connection between nginx and IIS is reset by IIS due to the default connection limits.

    This behaviour differs from you would experience on your own machine in that a 502 is actually returned, where the connection would normally just be terminated by IIS with no error code.

    You can actually reproduce the 502 in your browser too by accessing http://p2plendingdata.com/lendingclubodata.svc/vNoteDetails.

    I would advice to look at the request queries produced by various OData consumers and try not to fetch an entire collection in a single request (though I'm sure that wasn't your intention). Would also be nice if a tool like OData explorer had some sort of pagination when the collections are clicked in the UI, but apparently it doesn't (yet).

    Let me know if there's anything else I can do to help you on this one.

    Best regards,
    Rune

  2. rune closed this discussion on 07 Feb, 2011 07:04 PM.

  3. joelmartinez re-opened this discussion on 08 Feb, 2011 02:06 PM

  4. 2 Posted by joelmartinez on 08 Feb, 2011 02:06 PM

    joelmartinez's Avatar

    That really helped me figure it out Rune, thanks!! yes, you are correct that it was due to too many results. I've implemented page limits on the odata service to avoid the problem of too many results:
    http://blogs.msdn.com/b/astoriateam/archive/2010/02/02/server-pagin...

  5. joelmartinez closed this discussion on 08 Feb, 2011 02:06 PM.

Discussions are closed to public comments.
If you need help with AppHarbor please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac