-
-
Notifications
You must be signed in to change notification settings - Fork 231
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
Handle send errors #243
Handle send errors #243
Conversation
d3d420c
to
9b66e83
Compare
I suggest waiting for my HTTP/2 CONNECT (http2-connect branch) work to be complete because the socket will not always be a real socket and I suspect that this solution will not work in that case. I also dislike using a message, I'd rather return a command, though let's first see what the implications would be for proxies (TLS proxies may close the connection at the TLS level and this needs to be handled in a different way than when the real socket closes). |
Hi! I'm collaborating with @bjosv on this. Do you want us to rebase this PR on the http2-connect branch? This PR just addresses the fact that the return value from The message passing to Can you clarify "I'd rather return a command"? Do you mean gun_http2:request, gun_http2:maybe_send_data, etc. should return something to trigger a new state in the gun state machine? |
Do not rebase against http2-connect, it's still undergoing significant changes. For HTTP/2 CONNECT, yes the fake sockets still return errors (potentially, anyway), however the error has to be routed to the correct proxy layer (so if you have, for example, the socket at the end of the HTTP/2 CONNECT -> HTTP/2 CONNECT -> HTTP/1.1 returning an error, it must be handled by the middle layer, not by the innermost layer.
Yes. There is already an |
9b66e83
to
9eb659a
Compare
Hello, I see you probably noticed that I merged the http2-connect branch. :-) Note that I don't think sending ourselves a message is going to work well due to tunnels. I'm going to see if making all callbacks follow the |
I think work on this can be resumed. Like I've said earlier an error command should be returned. If it's in a callback that currently returns |
This one would be good to have in 2.0. I'll give it a try. |
9eb659a
to
89933cc
Compare
I've done a large rewrite now to propagate the errors as commands. A command is returned instead of a state by these Protocol functions (already merged in #285):
In gun_http2, several functions may return a state or an error instead of only a state, e.g.
Also gun_http and other modules are updated. I think "http2" can be removed from the PR name since send errors are handled for all protocols. |
Sounds good. But it's too big for me to look at today. If there's minor issues I will fix them during merge. |
There's more than minor issues. The todos need to be resolved. But perhaps you'd prefer for me to do the implementation for |
Yes, that would be good. I must confess I'm a bit lost in the tunnels. I'd be happy if you can give me some pointers. |
There's a page in the user guide about the internals of the implementation. Please read it and tell me if this helps at all. I can improve while it's still clear in my mind. |
Do you mean "TLS over TLS"? I have seen it but I don't fully understand how things should be propagated. |
Well the question is less about propagating and more about handling send errors also for the fake sockets, and what to do when that happens. Probably only stop the relevant stream for HTTP/2. But the entire connection for HTTP/1.1. Hence why I mention |
Hi @essen , any more thoughts about the Also, do you have any thoughts about incorporating this in steps? I guess we could incorporate the error propagation support first, then add send-error support for each protocol in steps. Or do you see a scenario that hinders this? |
8b89aa3
to
748afaf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do this in steps. I have pointed out in review comments some of the bits that I think should be merged as a first step. The list is not exhaustive. Could you open a PR with these types of changes? They relate to returning commands instead of state. Any other change should be left for step 2 (details TBD).
Done. Please have a look here: #285. |
748afaf
to
508a64e
Compare
Rebased. |
Thanks. Will go over this probably on Thursday. |
To get faster reaction times on failing socket-send of echos/requests we now handle the response from the Transport:send call. Co-Authored-By: Viktor Soderqvist <[email protected]> Co-Authored-By: Bjorn Svensson <[email protected]>
508a64e
to
b402a7a
Compare
FYI: Just rebased. No need to review. |
I have pushed a commit that handles HTTP/2 tunnel errors on top of the PR that was merged. |
Awesome. I'll rebase this PR again onto latest master.
Do you think I should rewrite all these to return |
I'm not sure, I was wondering about doing this with the tunnel changes but kept it simple. Considering the other changes you have in this PR (such as in gun_tunnel), perhaps this could be a good next step to normalize this in a separate PR. Let's retain the "StateOrError" variable names since they're not the full "Commands". |
I have updated this PR after #301 was merged. Is there anything else that should be done in a separate PR or is this one small enough now? |
Almost there! |
Merged, thanks! |
[To get faster reaction times on failing socket-send of echos/requests
we now handle the response from the send call where applicable.
To avoid a larger change in the statemachine a send error triggers an
event and is handled like a remote socket error/close.
Fixes #227 and touches #224
This PR is a proposal and should be seen as a base for discussing how to solve it the best way,
and ideas/comments are welcome.
(http and ws should have the same final solution, and tests can be cleaned up a bit aswell..)