-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
Some requests not finishing with 0.77.0? #183
Comments
Yeah I’m also seeing some bugs, I will investigate today. |
Unsure if related, but possibly/probably: After a few hours of debugging, I've found that in a Rails application, As far as I can tell in our Rails application, nothing will actually call In the above commit, I test |
Are you able to update to the latest versions of async-http, protocol-http*, io-stream and any dependencies, it should fix all the issues. |
(Also, I'll add your reported failure as a test case to async-http so we won't have any regressions). |
I am seeing the above issue with:
I believe these are all the latest versions. |
Okay, thanks for the report, I'll investigate it today. |
I have made another round of bug fixes and performance improvements. However, I have not investigated the above issue yet. Sorry. |
I'm trying to reproduce the issue here: #185 So far, I'm not having a lot of luck:
@korbin do you have a reproduction that I can use? |
I also made this change fairly recently: socketry/protocol-rack@d34fabd Can you confirm you are using the latest version of I wonder if we need to make the same change here: https://github.com/socketry/protocol-http/blob/8244dbf54d05619713140a113b76b74e49c680fd/lib/protocol/http/body/stream.rb#L298. |
Maybe socketry/protocol-http#71 is sufficient to fix this issue. @korbin are you able to test it? |
I can confirm this issue is still happening (both with and without the bundle exec falcon host falcon.rb
curl -X POST http://127.0.0.1:3000/ -H 'Content-Type: application/json' --data '{}' You should see that the log output I've added in If you uncomment my If we look at the underlying Rails handlers:
The issue is that if I specify a content https://github.com/socketry/protocol-http/blob/main/lib/protocol/http/body/stream.rb#L58-L61 -- Possible fixes:
|
Thanks this looks really helpful. I'll work on it today. |
I can confirm that even without my custom stuff (leaving |
Thanks for your reproduction, I can see the issue. |
I see, so the actual issue here is that Rails will read the body, without exhausting it: https://github.com/rails/rails/blob/f86f52acab6f94c79d175f5567013b9512d50886/actionpack/lib/action_dispatch/http/request.rb#L470-L480 Your proposed solutions are reasonable, and I think:
is the best option, simply because this is Rack specific semantics. In other words, it's entirely possible for the underlying request to lie about content length... in theory, it should call We should probably use The root cause of this problem is how Rack specifies the input stream.
|
For a little more clarification on my thinking, I see this as acceptable behaviour. The underlying connection state machine is independent of the application code correctly processing the input and output. In other words, the expectation is, the input is completely read. |
In addition, eventually it might like to think about whether we want to change Rails or Rack to clarify this behaviour. IOW, if content = input.read(content_length)
# discard all remaining input:
input.read |
Wicked, thanks for the extra details @ioquatix. FWIW, since I've been seeing this problem with Sinatra too, I'd imagine trying to fix this in Rack (or just |
I've released |
By the way, let me state how grateful I am for your detailed bug reports, support and patience. |
Hello,
Upon upgrading to
0.77.0
, I am seeing some 303 requests that don't seem to finish (or close). I can't quite tell what's happening other than Falcon is just not letting the request complete. The request just sits there indefinitely. Not 100% of these requests do this, but in my testing a good 90% of them do. I might be lucky if 1/10 requests get the full response sent to the browser.Downgrading to 0.76.0 fixes the issue.
I might be seeing this on other responses but I am for sure seeing this on requests that return a 303 on a POST request, like say, redirecting after a login. This is in a Sinatra app, by the way. The response bodies for these requests are 0 bytes, they just contain a location header. They are also all HTTP 1.1 requests.
Hope that's enough to help troubleshoot this. I can try to get more debug info if required.
Thanks!
The text was updated successfully, but these errors were encountered: