-
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
Experiment for aborting callbacks #11876
Conversation
The current status is that I have:
I think there is a bit of work to do, but once done in ICB, it should protect most of the rest of the codebase from these complexities. |
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
@lorban wrote:
If an
I've played with lots of different ways of breaking down the current single event into two events, including as you have suggested. I'm currently going with the current contract mostly based on naming. Because we already have a method called |
IteratingCallback reimplemented
IteratingCallback reimplemented
testing abort in every ICB state.
testing abort in every ICB state.
testing abort in every ICB state.
@lorban hmmm I've broken a few tests.... more than I would have expected..... |
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
@gregw I pushed the (minimal) necessary modifications needed to fix the IllegalArgumentException in SocketChannel.write() and I'm happy to report this branch now fixes the original problem. As you can see, I've had to replace a Conclusion: no one (not us, not our users) should ever do I'm even tempted to set the default Oh, and I finally figured |
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/Callback.java
Show resolved
Hide resolved
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/Callback.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/Callback.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/Callback.java
Show resolved
Hide resolved
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/ExceptionUtil.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/IteratingCallback_State.puml
Show resolved
Hide resolved
jetty-core/jetty-util/src/test/java/org/eclipse/jetty/util/CallbackTest.java
Outdated
Show resolved
Hide resolved
I discussed the latest state with @sbordet and he raised two points:
|
Sure - the more useful Helpers, then the less likely code is going to try to make their own.
I don't see how that could work. We need to flow abort-then-complete semantics through all our callback chains. If Callback didn't have abort, then all those chains would be broken no matter what??? Essentially we have the implementation of abort only in Abstract, but the signature in Callback, so all implementations should be aware they need to do something. |
I'll change For completeness, we could add a |
Hmmm, I think I have found a use-case for having just a onFailure(Throwable) which is called immediately on abort or failure, in addition to onCompleteFailure.... I'm working on that now... |
What difference do you see between |
The onCompleteXxx methods are only called when the callback is complete, which may not need immediately on an abort |
Friendly reminder that these changes may impact Spring's Jetty Core support. |
ICB.onAbort(Throwable) calls ICB.failed(Throwable) by default.
@sbordet @lorban I think we have an issue with extensions of ICB that override Also, almost all of our ICB usages need to be reviewed to make them correctly handle |
ICB.onAbort(Throwable) calls ICB.failed(Throwable) by default.
@sbordet I'm also now a bit cautious about the change you asked for, where it is |
@lorban @sbordet remind me again why we can't resolve this issue by removing buffers from a pool? Currently we have to revisit every callback that does a release and make sure it separates out abort from failed behaviour.... I think that is going to be less invasive and can be done simply in 12.0.x without revolution. Note that I think there are some good generalizations of abort in this PR, as well as some good fixes to ICB, but I think it would be a lot simpler if it didn't delay complete failure waiting for a succeeded/failed callback. We can do these in 12.1.x |
@gregw we considered removing the buffer from the pool, but the solution was dismissed because it looked as complex as introducing Looking back, it seems we underestimated the complexity of |
…tty-12.0.x/11854/abortCallback # Conflicts: # jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ConnectHandler.java # jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/IteratingCallback.java
…tty-12.0.x/11854/abortCallback # Conflicts: # jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java # jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/HttpOutput.java # jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/HttpOutput.java
…tty-12.0.x/11854/abortCallback
The previous semantic of `onCompleteFailure` has been renamed to `onFailure(Throwable)`, which is called immediately (but serialized) on either an abort or a failure. A new `onCompleteFailure(Throwable)` method has been added that is called only after a `failed(throwable)` or a `abort(Throwable)` followed by `succeeded()` or `failed(Throwable)`` No usage has yet been made of the new `onCompleteFailure`, but the ICB implementation has been completely replaced by the one developed in #11876
The previous semantic of `onCompleteFailure` has been renamed to `onFailure(Throwable)`, which is called immediately (but serialized) on either an abort or a failure. A new `onCompleteFailure(Throwable)` method has been added that is called only after a `failed(throwable)` or a `abort(Throwable)` followed by `succeeded()` or `failed(Throwable)`` No usage has yet been made of the new `onCompleteFailure`, but the ICB implementation has been completely replaced by the one developed in #11876
The previous semantic of `onCompleteFailure` has been renamed to `onFailure(Throwable)`, which is called immediately (but serialized) on either an abort or a failure. A new `onCompleteFailure(Throwable)` method has been added that is called only after a `failed(throwable)` or a `abort(Throwable)` followed by `succeeded()` or `failed(Throwable)`` No usage has yet been made of the new `onCompleteFailure`, but the ICB implementation has been completely replaced by the one developed in #11876
The previous semantic of `onCompleteFailure` has been renamed to `onFailure(Throwable)`, which is called immediately (but serialized) on either an abort or a failure. A new `onCompleteFailure(Throwable)` method has been added that is called only after a `failed(throwable)` or a `abort(Throwable)` followed by `succeeded()` or `failed(Throwable)`` No usage has yet been made of the new `onCompleteFailure`, but the ICB implementation has been completely replaced by the one developed in #11876 Signed-off-by: Simone Bordet <simone.bordet@gmail.com> Signed-off-by: Ludovic Orban <lorban@bitronix.be> Co-authored-by: Simone Bordet <simone.bordet@gmail.com> Co-authored-by: Ludovic Orban <lorban@bitronix.be>
This is another experimental attempt to solve #11854 by adding abort semantic to all callbacks