Skip to content
TheChatArchiveThe Chat Archive
composer-2.5· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

WebServer Idle timeout task lifecycle Part of #11854. Scope Idle timeout tasks should be…

  1. 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.java creates an IdleTimeoutHandler as 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.

  2. Assistant

    I'll tie idle timeout tasks to the listener lifecycle by exploring the current implementation and related tests.

  3. Assistant

    Implementing lifecycle management: moving idle-timeout start to listener startup and adding idempotent cancellation on stop/suspend.

  4. Assistant

    Creating focused lifecycle tests:

  5. Assistant

    Idle timeout tasks are now tied to listener lifecycle. Summary of changes:

    Implementation

    IdleTimeoutHandler

    • Added cancelTask() that delegates to TimerTask.cancel() (idempotent).

    ServerListener

    • Retains idleConnectionTimer and idleTimeoutHandler as listener state.
    • Removed constructor-time start; idle timeout now starts in startIt() when the listener binds.
    • Added startIdleTimeout() and cancelIdleTimeout() (nulls the handler first, then cancels — safe to call repeatedly).
    • cancelIdleTimeout() is invoked from:
      • stopResources() (stop)
      • suspendForCheckpoint() (suspend)
      • rollbackFailedStart() (failed startup cleanup)
    • Added test hook idleTimeoutCancelled() — returns true when no active handler is retained.

    LoomServer

    • Added listenerIdleTimeoutCancelled(String socketName) test hook, matching the existing listenerThreadState() pattern.

    Tests

    New ServerListenerIdleTimeoutLifecycleTest covers:

    • Stop cancels the idle timeout task
    • Suspend cancels the idle timeout task
    • Repeated stop() calls remain safe
    • Resume restarts the idle timeout task

    Tests use the package-private hooks and long idle periods (Duration.ofMinutes(1)) so they don’t depend on real-time timer waits.

    Note: Tests couldn’t be run in this environment because the project targets Java 26 and only Java 25 is available. The changes follow existing lifecycle patterns in ServerListener and should compile once Java 26 is available.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.