Skip to content

Fix idle timeout rescheduling - #15656

Open
lorban wants to merge 4 commits into
jetty-12.1.xfrom
fix/12.1.x/15386-timeout-rescheduling
Open

Fix idle timeout rescheduling#15656
lorban wants to merge 4 commits into
jetty-12.1.xfrom
fix/12.1.x/15386-timeout-rescheduling

Conversation

@lorban

@lorban lorban commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Fixes #15386

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
@lorban lorban self-assigned this Aug 24, 2026
@lorban lorban added the Bug For general bugs on Jetty side label Aug 24, 2026
@lorban lorban moved this to 🏗 In progress in FROZEN Jetty 12.1.13 Aug 24, 2026
lorban added 2 commits August 24, 2026 15:58
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
@sbordet sbordet moved this from 🏗 In progress to 👀 In review in FROZEN Jetty 12.1.13 Aug 31, 2026
CountDownLatch resetLatch = new CountDownLatch(1);
HeadersFrame frame = new HeadersFrame(newRequest("GET", HttpFields.EMPTY), null, false);
FuturePromise<Stream> promise = new FuturePromise<>();
client.newStream(frame, promise, new Stream.Listener()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use client.newStream(frame, new Stream.Listener()...); for simplicity.

@Override
public boolean handle(Request request, Response response, Callback callback)
{
// Add a listener to force notIdle to run in a separate thread after cycle timeout rescheduling.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The comment is unclear: how does adding a timeout listener forces notIdle() to run in a separate thread, which notIdle() does it refer to, etc.

Comment on lines +904 to +906
h2.setStreamIdleTimeout(idleTimeout);
prepareServer(h2);
connector.setIdleTimeout(idleTimeout);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would not set the stream idle timeout to be the same as the session idle timeout, it is just asking for races and flakyness.

If it is the stream that idle times out, just set the stream idle timeout, and force the session idle timeout to be larger, e.g. 10x.

Stream stream = promise.get(5, TimeUnit.SECONDS);
ByteBuffer data = ByteBuffer.allocate(1024);
stream.data(new DataFrame(stream.getId(), data, true), Callback.NOOP);
assertTrue(resetLatch.await(3 * idleTimeout, TimeUnit.MILLISECONDS));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It is not clear how the test receives a RST_STREAM, given that the idle timeout listener returns false every time, therefore ignoring it.

It is because the callback is not completed?

The test is difficult to interpret, and it is not evident the connection between the test setup and the assertions later.

{
try
{
Thread.sleep(idleTimeout / 4);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you not use the utility sleep() method here?

@lorban lorban moved this to 🏗 In progress in Jetty 12.1.14 Sep 1, 2026
@lorban
lorban force-pushed the fix/12.1.x/15386-timeout-rescheduling branch from 3d594ea to 80923f7 Compare September 2, 2026 10:22
…ld not send a reset frame only because the timeout listener returns true

- rework HttpStreamOverHTTP2 channel recycling to use 3 states: can the channel be recycled, ca it not be recycled and are we past the recycling point as timeout and failures must mark the channel as non-recyclable but must continue to notify the channel until the recycling point has been reached
- make sure channels are not recycled when Connection.isRecycleHttpChannels() is false

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
@lorban
lorban force-pushed the fix/12.1.x/15386-timeout-rescheduling branch from 80923f7 to c963d5d Compare September 2, 2026 10:26
@lorban
lorban requested a review from sbordet September 2, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug For general bugs on Jetty side

Projects

Status: 🏗 In progress

Development

Successfully merging this pull request may close these issues.

Issues in http2 stream idle timeouts

2 participants