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

Jetty 12 idletimeout #9905

Merged
merged 29 commits into from
Jun 14, 2023
Merged

Jetty 12 idletimeout #9905

merged 29 commits into from
Jun 14, 2023

Conversation

gregw
Copy link
Contributor

@gregw gregw commented Jun 13, 2023

Rework idle timeout mechanism, undisable tests

gregw and others added 26 commits June 6, 2023 18:01
 + pass TimeoutException through all APIs
 + HttpConnection now passes on TimeoutException to HttpChannel.onFailure
Signed-off-by: Simone Bordet <[email protected]>
* Improved reset of the earliest timeout before iteration.
* Removed check for getExpireNanoTime() == -1, since it's a valid value.
* When onExpired(Expirable) returns false, the Expirable should arrange to move its timeout in the future.

Signed-off-by: Simone Bordet <[email protected]>
….failed() in all cases to complete the wrapped callback.

Signed-off-by: Simone Bordet <[email protected]>
…ll super.failed() in all cases to complete the wrapped callback."

This reverts commit 5ac57c1.
@gregw gregw requested review from lorban and sbordet June 13, 2023 07:12
@gregw gregw marked this pull request as ready for review June 13, 2023 07:13
@gregw gregw requested a review from lachlan-roberts June 13, 2023 07:13
@gregw
Copy link
Contributor Author

gregw commented Jun 13, 2023

@lorban @lachlan-roberts The key changes in this PR are:

  • lots of simple mechanical changes to pass TimeoutException instead of Throwable when it is known to be a timeout.
  • Request has been updated to have two types of listeners: for failures and for timeouts. Failures cannot be ignored, timeouts can be.
  • HttpChannelState is where the majority of the changes have been made and to invoke the various listeners.
  • The production of an error response now uses a second ChannelResponse instance. This is to avoid the race where the original handler is still writing to the response whilst an error handler is trying to write the error page for an asynchronously delivered error.

# Conflicts:
#	jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ServletChannel.java
#	jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/HttpChannel.java
lorban
lorban previously approved these changes Jun 13, 2023
Copy link
Contributor

@lorban lorban left a comment

Choose a reason for hiding this comment

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

There are quite a few TODOs in the tests, but we can tackle them after the 12.0.0 release.

So LGTM.

@@ -1202,6 +1203,23 @@ public void call(Invocable.Callable callable, Request request) throws Exception
}
}

public <T> boolean test(Predicate<T> predicate, T t, Request request)
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks unused. Should we keep it nevertheless?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lorban It has been used before, but now that we don't have listening predicates..... oh but wait yes we do. This should be used by the context addIdleTimeoutListener wrapper that is not implemented!!!! stand by.....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lorban I've added the context wrapper so idle timeouts are callback in the context. I've also added a test to check that. Please re-review... at least that last commit.


// TODO what do we do about the failing write?
// should timeout errors be non persistent?
Callback ocb = callback;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we keep this wrapping?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

long term no, but whilst we still have work to do....

}

@Test
public void testIdleTimeoutNoListenerHttpConfigurationOnly() throws Exception
Copy link
Contributor

Choose a reason for hiding this comment

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

I fail to see what this test asserts that the above one (testIdleTimeoutNoListener()) does not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one has the idle timeout configured in HttpConfiguration only, so it is testing that it is correctly applied by HttpChannel. I.e the idle timeout between requests is 10x the idle timeout during requests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(probably could have been parameterised... will do when I next touch this test.)

lorban
lorban previously approved these changes Jun 13, 2023
@gregw gregw merged commit 963d331 into jetty-12.0.x Jun 14, 2023
@gregw gregw deleted the jetty-12-idletimeout branch June 14, 2023 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants