5

I'm working on http://www.lovethesales.com - and have come up against an annoying issue.

As you'll probably be able to see for yourself on the homepage, sometimes, and intermittently, image requests will fail with a 502 Bad Gateway error. This seems to happen in all browsers - (you can see the red failed requests in the Chrome developer tools, for example)

The resource in question /imageproxy can never return anything other than a 200, or a 304.

1) This page (set to show 500 results) never seems to have broken images, even though it's making similar / the same requests, but showing even more of them:

http://www.lovethesales.com/sales/?take=500

2) If you CTRL + refresh - it's always fine, it's only if you do a 'soft' headers refresh do you receive a 502 error. (Just clicking the refresh button)

The handler is a standard IHttpHandler, registered as follows:

<add name="ImageProxy" path="/home/imageproxy*" verb="*" type="LoveTheSales.Handlers.ImageProxy" resourceType="Unspecified" preCondition="integratedMode" />

Any advice / ideas on how to tack this down would be most appreciated.

Cheers, Dave

[EDIT] I have managed to recreate the issue on my test Azure instance (only me using it) - and, after turning on full web/request logging - I can see that the 502 requests are never even making it to my application - they aren't even in the logs. I guess this must be an Azure error?

[EDIT 2] This also happens on non-Imageproxy requests, so, simple static images too

Dave Bish
  • 17,987
  • 6
  • 40
  • 60
  • 1
    Have you tried accessing the site from more than one location? 502 can indicate an issue with the proxy server between your browser and the site itself. When I navigate your site (admittedly a cursory examination), I don't get the error. – nateirvin Jul 30 '14 at 14:50
  • I also can't recreate the error. – user1477388 Jul 30 '14 at 14:51
  • I get it from both work / home - it's only on the homepage, and only on a method=head request, it seems – Dave Bish Jul 30 '14 at 14:52
  • I should add - you must be clicking 'refresh' for this to happen - not forced refresh, though – Dave Bish Jul 30 '14 at 14:53
  • Three strikes ;) -- I also could not duplicate and tried on both Win 8.1 and XP using IE11 (win8), IE8 (xp), Chrome and Firefox ... are you going through a proxy by any chance or do you have some other software intercepting your web requests? – Scott Prokopetz Jul 30 '14 at 16:16
  • Firstly - thanks everyone for your help - i really appreciate it. I would really appreciate if you would follow these steps, and confirm this to me again - 1) Visit the site homepage 2) open chrome dev tools, filter on images 3) click refresh (not ctrl+refresh, just refresh) - do you see any failed requests? I see them from multiple computers, as do other developers I'm working with, in other locations. If nobody else gets this - I'm really, really confused. – Dave Bish Jul 31 '14 at 09:33
  • i followed your steps but doens't seem to be happening for me. have you checked into any crashes of your app pool like described in my answer? – Batavia Aug 06 '14 at 20:50

1 Answers1

1

a few things i tend to do with issues like this

1) Make a fiddler trace. This issue seems hard to reproduce for some users/circumstances. tools like Fiddler allows you to record exactly what is happening. Especialy interesting would be what (if anything) is different between failing and succeeding requests/responses

2) Make it so the user don't notice it. For example a jquery error handler that just resubmits the request. I've had it happen just once (of course before i turned on fiddler myself). If the issue is rare enough maybe it's just good enough to handle that 0.1% of the cases where it goes wrong gracefully.

3) perform a serious load test (locally). if you look here http://blog.wouldbetheologian.com/2014/07/502-bad-gateway-error-on-azure-websites.html there might be a underlying causes that crashes your app pool. This would not get logged, a new instance gets spinned up but you get a 502 requests on requests to your old instance.

Especially this last case is something that would fit the little i can see of your scenario.

Batavia
  • 2,424
  • 12
  • 16