-
Notifications
You must be signed in to change notification settings - Fork 202
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
fixes #1227 (https://github.com/yegor256/takes/issues/1227) #1294
Conversation
@EugenDueck I can't understand why github actions jobs are stuck. Can you please try to push something small into the branch, to restart them? |
…d why github actions jobs are stuck. Can you please try to push something small into the branch, to restart them?"
@EugenDueck it seems that your test is stuck. Did you run the build locally? It passes? |
@yegor256 My bad! I hadn't run the other tests after fixing the issue. socket.getOutputStream().write(
new Joined(
BkBasicTest.CRLF,
BkBasicTest.POST,
BkBasicTest.HOST,
"Content-Length: 11",
"",
"Hello First",
BkBasicTest.POST,
BkBasicTest.HOST,
"Content-Length: 12",
"",
"Hello Second"
).asString().getBytes()
); This still does not make the test finish. I will dig deeper when I find the time, hopefully next week. |
…ose socket, while server waits for client to close socket
There was a deadlock in the test (the test waited for the server to close the socket, while the server waited for the client to close the socket). The commit I just pushed is supposed to fix that. With that, the tests all pass locally. As to the failing CI checks, I'm not sure how to read them. Looking at a couple of recent commits, most of them lead to failures and cancellations of one way or another. However, looking into this issue lead me to discover a couple of issues that I would like to discuss, and therefore would like you to not merge this PR in its current form.
shows the immediate closure of the connection by Takes:
I don't feel like it is a good idea to fix 1., without also addressing 2. I would like to have a reliable "persistent connection" implementation first, with tests that show that it works, before fixing this bug, while making sure that persistent connections still work. Actually, my preferred approach would be to proceed in this order:
Why do I suggest removing the persistent connections feature? Because that feature is barely working, as the tcpdump shows. And fixing the current implementation is not a trivial matter, in particular due to the need to implement a keep-alive timeout to prevent indefinite blocking of the connection and thread, which means coordinating with at least one more thread - unless of course we go NIO, which however would amount to a complete rewrite of the whole framework. So we would just remove something that cannot be used in its current form, cannot be fixed easily, but introduces problems. What do you think? |
When socket.getInputStream().available() returns 0, parsing of the request headers will be aborted. I guess the assumption was that available is 0 only in case of "end of stream", which is not true:
I think the appropriate thing to do is to get rid of the code that checks available() altogether, which is what this PR does. In order to reliably determine whether we have reached the end of the stream, we need to read(). No way around it.