I am trying to understand why my toolforge tool (https://wdreconcile.toolforge.org) returns HTTP 502 errors for some URLs.
The tool is written in Python 3.7, deployed with Kubernetes via WSGI.
In my experience, HTTP 502 errors signal a lack of connectivity between the HTTP server and the WSGI process. This normally happens when the service is overloaded or just times out. But this time, there are specific URLs which reliably return 502 errors for an extended period of time, while any variation around them will succeed.
I am puzzled by two things:
- the URL reliably returns HTTP 502 errors, and does so instantly (no timeout)
- if I change the query slightly (for instance by changing "Magdalena" to Magdalen", or changing any character in the query) then the problem disappears.
- the query runs fine on a local instance of the service
Therefore I am starting to wonder if HTTP 502 errors could be cached by some layer, between the WSGI process and the HTTP server?
I also observe 502 errors in POST requests, but is not clear to me whether they could also be affected by caching issues (I hope not, since caching POST requests is obviously an issue on its own).
For reference, the text returned with the 502 error is:
502 Bad Gateway openresty/1.15.8.1