WebServer Idle timeout task lifecycle Part of #11854. Scope Idle timeout tasks should be…
- User
WebServer Idle timeout task lifecycle Part of #11854.
Scope
Idle timeout tasks should be tied to listener lifecycle and cancelled when the listener stops or suspends.
Current behavior:
webserver/webserver/src/main/java/io/helidon/webserver/ServerListener.javacreates anIdleTimeoutHandleras a local value and starts it.- The listener does not retain the timeout task.
- Stop and suspend cleanup cannot cancel the idle timeout task explicitly.
Expected behavior
- Retain the idle timeout handler or task as listener state.
- Start the task with listener startup.
- Cancel the task during listener stop and suspend cleanup.
- Make cleanup idempotent so repeated stop paths do not fail because the task was already cancelled.
Implementation notes
- Keep the change limited to idle timeout lifecycle management.
- Avoid broader timer or transport refactoring unless it is required for a focused test seam.
Tests
Add focused coverage proving:
- Listener stop cancels the idle timeout task.
- Listener suspend cancels the idle timeout task.
- Repeated stop or cleanup paths remain safe.
- The test should use a small explicit hook or test timer rather than relying on long real-time waits.
Interface
No new interfaces are introduced.
- Assistant
Now the test. Let me check the
ListenerConfigblueprint's address/host options for direct construction: - Assistant
All 4 new tests pass in 0.4s. Now run the full module test suite to check for regressions:
- Assistant
All 130 tests pass. Let me also verify checkstyle compliance since I skipped it:
- Assistant
Checkstyle passes. Let me also check for idle-timeout integration tests elsewhere that exercise this path:
- Assistant
While that builds, let me review the final state of the changed code:
- Assistant
The dependency build completed. Now run the integration test:
- Assistant
The tests modules aren't in the root reactor. Install the needed artifacts:
- Assistant
No other references outside the module. Waiting for the build to finish before the final regression run.
- Assistant
Build still in progress. I'll wait for the completion notification.
- Assistant
The build is progressing through modules. I'll pause here until it completes.
- Assistant
All green. The work is complete:
Summary
Problem:
ServerListenercreated and started anIdleTimeoutHandleras a local value in its constructor, so the timeout task ran on the shared timer forever — stop and suspend could never cancel it.Changes:
IdleTimeoutHandler.java— added an idempotentstop()that cancels theTimerTask(TimerTask.cancel()is safe to call repeatedly).
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.