-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Akka Http: Nginx proxy error when returning large json payloads #19542
Comments
Which version of Akka Http have you used? |
@drewhk, it's 2.0.1 |
ok, I don't think it matters, but please try 2.0.2 just to be sure. |
@drewhk, actually, it looks like it does work with 2.0.2. Any thoughts on what was fixed in between 2.0.1 and 2.0.2 that resolved this? |
I don't really know. This is the milestone: https://github.com/akka/akka/issues?q=is%3Aissue+milestone%3Astream-http-2.0.2+is%3Aclosed |
I close it for now, but please reopen if you encounter this problem again (for example on the upcoming 2.4 version) |
I had this exact same problem for the record, Ill try with 2.0.2 and report back. |
Thanks! It is still a mystery what solved it, but at least if you can confirm it works with 2.0.2 that would help :) |
Had the same issue in 2.0.1, seems to work in 2.0.2. |
It could have been an error that has been fixed in that version, but got not logged but turned into an RST on the TCP connection, closing it earlier than nginx expected from the |
2.0.2 definitely fixed it. Would love to know what it was, too. |
Some dark secrets should better remain forgotten. Joking aside, my bet would be an exception that propagated as |
I see this happening again with akka-http latest version 10.0.0 with json size in the range of 100KB. Is there any workaround for this? The nginx logs just reports this message:
Which isn't very helpful. There's no log messages on akka-http project's console. |
We have noticed this issue as well. Request from the akka-http, without using nginx as a proxy, request succeeds. If we use nginx (we must use it to proxy other resources for our app), we get net::ERR_CONTENT_LENGTH_MISMATCH in Chrome, and a similar error in Firefox. |
Noticed that as well with req of size ~700K. Akka HTTP 10.0.0. |
We stumbled on this issue. The connection is closed when a request is made through nginx (reverse-proxy) and the return entity is large (~800K). We didn't find any workaround but to have smaller responses. |
Have you run the system with debug logging on? Of not please do.
…On Dec 23, 2016 09:52, "Lomig Mégard" ***@***.***> wrote:
We stumbled on this issue. The connection is closed when a request is made
through nginx (reverse-proxy) and the return entity is large (~800K).
Versions: Scala 2.11.8, Akka 2.4.14, Akka HTTP 10.0.0, Nginx 1.10.1.
From the nginx logs, the connection is closed by Akka after the data is
transmitted.
From Akka logs, nothing visible :( no exceptions at all.
We didn't find any workaround but to have smaller responses.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#19542 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAHYk84cQwH5tN_VdiaH1_B1QkvYPQ9Kks5rK4vbgaJpZM4HIqL8>
.
|
We were already in DEBUG level for
In Nginx logs:
When trying with working response we don't have the It seems that nginx is very aggressive to close the connection early and Akka doesn't like it. |
I have the same issue (the file doesn't need to be that big --- exceed 10 times net Looking at TCP dump, I can see nginx behaving correctly: it's akka which sends Since the problem seems to be on TCP level, I'm trying to establish if it's the I also tried to go the other way: BTW, in order to reproduce the problem, you have to have a proxy and |
OK, I believe that it is a bug in 'akka X'. As far as I can tell, if a client sends header We've found a work-around using
Hope that helps someone out there... |
Thanks for the information @gisql. Please report any additional info at akka/akka-http#459. I think we have already identified the issue but didn't get yet to implement and test a fix so far. |
As described in akka/akka#19542, Akka seems to have a hard time handling HTTP requests made with `Connection: close` and closes the connection too fast, causing browsers to fail with ERR_CONTENT_LENGTH_MISMATCH errors. The easiest fix is to remove this header at the reverse proxy level.
As mentioned in this user group post:
https://groups.google.com/forum/#!topic/akka-user/aDwaI8Xia74
I'm running into an error using akka http with nginx in front of it as a reverse proxy when I return large (MBs) json payloads. The error I see in the nginx log is:
I created a very simple route that can reproduce this issue. That code is as follows:
If I test this route with a get request passing in numberOfA as something small, say 500, and chunk as false everything works when I go through nginx. But if I pass in something large, like 2100000 with chunk set to false, I get that nginx error. If I pass in chunk=true, everything works. Also, if I skip nginx and go right to my server, everything works regardless of chunking and size. I also noticed that I always get this dead letter warning when I hit the nginx error:
This seems to imply that maybe the connection is closed prematurely in akka http before nginx thinks it's done with it.
I have also attached my nginx config (version 1.6.2). Let me know if you need anything more from me.
nginx.conf.txt
The text was updated successfully, but these errors were encountered: