-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
4xx and Unexpected EOF #660
Comments
The handler is leaving just after you start the goroutine. I don't know what do you mean with Maybe you can try by adding a proxy in between AWS and fasthttp to log the requests. |
I don't want to send anything to the user, i just need to send back 200. I get data for processing, but client does not need to know anything about what happened later. |
I remember a user having troubles with AWS using keepalive messages. Try disabling the keepalive. |
I have seen this thread, but I really would like to avoid disabling keepalive as this would kill performance. Still, I will try this and see what happens. Thanks. |
Sounds like this is the AWS loadbalancer closing the connection while fasthttp is trying to read the next request. Are you able to modify the fasthttp source you compile with to test something for me? I'm thinking this line: Line 1900 in be93fbd
should probably be: if err != io.EOF && err != io.ErrUnexpectedEOF { Or if that doesn't fix it I'm wondering if the AWS loadbalancer maybe sometimes opens a connection and then closes it again without sending a request. |
Try this branch if you can: https://github.com/valyala/fasthttp/tree/aws-unexpected-eof |
Thanks, I will try to release this as fast as I can and get back to you. As I can't replicate this behavior locally, I will need to verify this on live system. |
Hey @erikdubbelboer , I have release version based on your branch and I am still getting this:
In case there is no easy fix for that is there a way to suppress this errors ? |
Sorry for the slow reply. Interesting to see that the connection gets closed with EOF so soon already. I'm thinking the loadbalancer closes connections that haven't seen any requests yet. We ignore EOF errors if it's after the first request as that will just be a keep-alive connection closing. But we print this error if the connection is closed before any request arrives at all. I have updated https://github.com/valyala/fasthttp/tree/aws-unexpected-eof once more. Would you mind testing it another time? |
Judging by the frequency of this error in @mwpolcik's logs (4+/min), I'm going to wager that this is a high traffic public facing API (>100krpm). Theory 1
Theory 2
See PR #682 |
* #660 Incorrect content length * fix * unexpected EOF is expected * Prevent test from panicing should err ever be nil
Hey @erikdubbelboer and @kevburnsjr . Sorry for not updating this issue earlier, got caught up. I think in most cases Theory 1 is correct. After some more investigations we were able to find that most of the requests that are getting 4xx are in most cases malformed in some way. For now we've tweaked a little bit our general configuration:
@kevburnsjr you are right about nature of the application. We are getting 6000 QPS right now and with the above configuration we are expecting to double this number without any problems as logs are quite clean right now. In short - we can close this issue and anyone who will have similar issues can learn from our mistakes. |
@mwpolcik just wondering, are you still using the |
Hey everyone, I started to use fasthttp in one of my projects and I am seeing quite often this error:
To give you more context:
unexpected EOF
occurs.I am reading what I need from request, start go routine to process data and return right away.
I was trying different configurations for server, but I am still getting
unexpected EOF
and I am not sure what I am doing wrong here. Any help appreciated.The text was updated successfully, but these errors were encountered: