Skip to content
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 #10277 - Review read failures impacting writes. #10948

Merged

Conversation

sbordet
Copy link
Contributor

@sbordet sbordet commented Nov 29, 2023

Separated read failures from write failures.
In this way it is possible to read even if the write side is failed and write even if the read side is failed.

Separated read failures from write failures.
In this way it is possible to read even if the write side is failed and write even if the read side is failed.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet sbordet requested review from gregw, joakime and lorban November 29, 2023 18:50
@sbordet sbordet linked an issue Nov 29, 2023 that may be closed by this pull request
2 tasks
@@ -1115,78 +1111,76 @@ public void write(boolean last, ByteBuffer content, Callback callback)
{
long length = BufferUtil.length(content);

HttpChannelState httpChannelState;
HttpChannelState httpChannel;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this name change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shorter and used elsewhere as just httpChannel.

@joakime
Copy link
Contributor

joakime commented Nov 29, 2023

Interesting.
This PR has tests that have historically expected a failure are now succeeding unexpectedly.

gregw
gregw previously approved these changes Nov 29, 2023
@gregw gregw dismissed their stale review November 29, 2023 20:53

wrong PR

Fixed tests.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet sbordet requested review from gregw and joakime November 30, 2023 07:28
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@gregw gregw dismissed their stale review November 30, 2023 11:40

Comments addressed

Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sbordet the changes for the existing write failure are good... but the change to call onFailure appears to be breaking some tests. Can we revert those and try after this release? I have some more error changes that might be needed to handle the AsyncIOServletTests that are currently disabled and that I will be looking at as part of #10933

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
// Try to fail the request, but we might lose a race.
try
{
request._callback.failed(failure);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've thought about this some more and I'm OK with this failed called, at least until we are sure. In the HandlerInvoker, we do similar if the call to handle throws. This is much the same thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gregw not sure it's the same thing. If we throw from handle() we documented "equivalent to fail callback", but throwing e.g. from a request listener or from a demand callback or from a write callback does not seem equivalent as leaving handle() with an exception.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sbordet I'm not sure either. Your build is green, so OK for this release... but it is a cautious OK.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sbordet throwing from a callback that is not meant to throw is a pretty good indication of an application that is not behaving correctly. I wonder at the wisdom of letting it hang forever saying "you should not have thrown and should have called the callback yourself", when we already know it is broken and if they complain that we have failed the callback, then we just say "don't throw!"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to always fail the callback in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think of it in a different way: it's an unexpected failure and we have a mechanism for that, failure listeners.

Register a failure listener and you will be notified and you can complete the callback (as you can't really do much else).

Here a proposal for a catch-all Handler.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The catch-all is a good idea regardless. I'm just worried about us being too purist. We know an application that throws from a callback is bad and we know that we will probably hang forever on that request.
I agree that we should never fail the callback if there is a possibility the application is acting correctly, but I'm OK with failing it when we know it is not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sbordet eitherway, let's punt to next release. we have more error work to do anyway.

Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll approve as I do not want to hold up the release.
But I still do not agree with the change to handling of exceptions thrown from serialized tasks. I think we are being too purist and it will bite us.

@sbordet sbordet merged commit 8638d80 into jetty-12.0.x Dec 6, 2023
7 checks passed
@sbordet sbordet deleted the fix/jetty-12/10277/read-failures-impacting-writes branch December 6, 2023 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Review read failures impacting writes
3 participants