-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Jetty 9.4.x 4855 h2spec failures #4946
Conversation
Code cleanups. Signed-off-by: Simone Bordet <[email protected]>
In case of bad usage of the API, we don't want to close() the stream but just fail the callback, because the stream may be performing actions triggered by a legit API usage. Signed-off-by: Simone Bordet <[email protected]>
In case of a call to `AsyncListener.onError()`, applications may decide to call AsyncContext.complete() and that would be a correct usage of the Servlet API. This case was not well handled and was wrongly producing a WARN log with an `IllegalStateException`. Signed-off-by: Simone Bordet <[email protected]>
Completely rewritten `HttpTransportOverHTTP2.TransportCallback`. The rewrite handles correctly asynchronous failures that now are executed sequentially (and not concurrently) with writes. If a write is in progress, the failure will just change the state and at the end of the write a check on the state will determine what actions to take. A session failure is now handled in HTTP2Session by first failing all the streams - which notifies the Stream.Listeners - and then failing the session - which notifies the Session.Listener. The stream failures are executed concurrently by dispatching each one to a different thread; this means that the stream failure callbacks are executed concurrently (likely sending RST_STREAM frames). The session failure callback is completed only when all the stream failure callbacks have completed, to ensure that a GOAWAY frame is processed after all the RST_STREAM frames. Signed-off-by: Simone Bordet <[email protected]>
@gregw @lorban see #4855 (comment) for a description of the problem and the solution. |
Fixed notification of HTTP2Session.abort(), that must fail all the streams before failing the session. Signed-off-by: Simone Bordet <[email protected]>
} | ||
} | ||
LOG.debug("Processing session failure on {}", getSession(), failure); | ||
// All the streams have already been failed, just succeed the callback. |
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.
Is this method still required? It doesn't override any contract?
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.
@sbordet ?
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.
I can see what it is doing, but it is hard to thoroughly review without more comments explaining each state transition and the races being faced. So can I get some more comments and then I'll review again
...-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java
Show resolved
Hide resolved
...-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java
Outdated
Show resolved
Hide resolved
...-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java
Show resolved
Hide resolved
...-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java
Show resolved
Hide resolved
...-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java
Show resolved
Hide resolved
...-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java
Outdated
Show resolved
Hide resolved
Added javadocs after review. Signed-off-by: Simone Bordet <[email protected]>
...-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java
Outdated
Show resolved
Hide resolved
} | ||
} | ||
|
||
private enum State | ||
{ | ||
IDLE, WRITING, FAILED, TIMEOUT | ||
IDLE, PRE_SEND, POST_SEND, SUCCEED, FAIL, FAILED |
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.
These states and their transitions should be javadoc'ed as it's not easy to grok what the FSM looks like by reading the code.
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.
Done.
* @param callback the callback to complete when the failure has been handled | ||
*/ | ||
default void onFailure(Stream stream, int error, String reason, Throwable failure, Callback callback) |
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.
I find this new method's signature and default implementation surprising. I would have expected that the error
and reason
parameters to go away especially since the overriding implementations just ignore them. Plus the fact that the default implementation drops the failure
in favor of calling the deprecated implementation instead of directly succeeding the callback also makes me scratch my head.
Maybe FailureFrame.getFailure()
should return some sort of H2Exception
that wraps the original exception as well as containing the reason and error code?
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.
This is at the HTTP/2 low-level API so our implementation may not use error
and reason
but users of these APIs may.
However, there are cases where we still have a failure but not an associated error
(e.g. idle timeout and aborts).
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.
Big block comments are good, but names are bad and more inline comments needed
...-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java
Outdated
Show resolved
Hide resolved
...-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java
Outdated
Show resolved
Hide resolved
...-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java
Outdated
Show resolved
Hide resolved
...-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java
Outdated
Show resolved
Hide resolved
...-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java
Outdated
Show resolved
Hide resolved
...-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java
Show resolved
Hide resolved
...-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java
Outdated
Show resolved
Hide resolved
...-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java
Show resolved
Hide resolved
More comments after review. Signed-off-by: Simone Bordet <[email protected]>
Updates after review. Signed-off-by: Simone Bordet <[email protected]>
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.
still a few things...
...-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java
Show resolved
Hide resolved
...-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java
Show resolved
Hide resolved
...-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java
Show resolved
Hide resolved
...-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java
Show resolved
Hide resolved
...-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java
Show resolved
Hide resolved
jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannelState.java
Show resolved
Hide resolved
jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannelState.java
Outdated
Show resolved
Hide resolved
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.
LGTM once the naming has been sorted out.
Updates after review. Signed-off-by: Simone Bordet <[email protected]>
@sbordet CI failed |
Fixed reset() to remember the failure. Signed-off-by: Simone Bordet <[email protected]>
The bulk of the fix is in 8d60636.