-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upstream prematurely closed connection while reading response header from upstream #1166
Comments
Is there any extra information I can give that would help in finding out where the problem lies? |
Hey @doender - this sounds like nginx timing out on the request. Likely problems:
If I was you I would monitor the database queries and see if anything is taking too long (and why). |
@ht2 It could be that the query can be optimized, but we have set the appropriate indexes and as far as I understand |
What's the query, and looking at your query logs can you see things taking longer than expected (say 60s)? I would recommend using the following tools to understand exactly where you might be seeing issue: https://gist.github.com/rantav/3433277 https://docs.mongodb.com/manual/reference/method/db.setProfilingLevel/ |
FYI, we're seeing this again but for another reason. In Node 8.14, URL length is limited to 8192 bytes: https://nodejs.org/en/blog/vulnerability/november-2018-security-releases/ ('Denial of Service with large HTTP headers') and nodejs/node@1860352 For this reason, calls to the aggregation API (where URLs can get quite long...) fail when long URLs are used (the UI service immediately closes the connection). We are now in process of downgrading to Node 8.13 because of this. @ht2 I think it would make sense to encode the pipeline in the request body. A |
Hey @doender - yea we've toyed with the idea of changing the aggregation to a POST endpoint (or at least adding one). Good spot on the 8.14 restriction. Up to now when we've hit this limitation it's been on the nginx side for us and we've simply upped the client buffers accordingly, but Node having the limitation makes this food for thought. |
Ok, looks like this was addressed in node 8.15.0 (and 6.16.0, 10.15.0): They added a command line arg, @ht2, you should be able to add this param to
https://futurestud.io/tutorials/pm2-how-to-start-your-app-with-node-js-v8-arguments I haven't gotten a chance to test this yet though! |
FYI I was able to get this to work by passing the argument directly to the pm2 restart command:
Note that you need to be running Node 6.16.0, 8.15.0, 10.15.0, or above. I can't seem to get it working by modifying the pm2 json files, but that may be because the command line argument overrides anything set in the json config. Also, |
Using the latest version of learning locker, I get the following nginx error when querying the
/api/statements/aggregate
endpoint.upstream prematurely closed connection while reading response header from upstream
This only happens when the amount of data that is requested is large.
The text was updated successfully, but these errors were encountered: