Skip to content

Bound event-loop termination waits and preserve close ownership - #357

Open
peter-lawrey wants to merge 4 commits into
developfrom
bugfix/bounded-event-loop-termination
Open

peter-lawrey wants to merge 4 commits into
developfrom
bugfix/bounded-event-loop-termination

Conversation

@peter-lawrey

@peter-lawrey peter-lawrey commented Sep 18, 2026

Copy link
Copy Markdown
Member

A secondary caller stopping a stuck event loop continued polling after the five-minute deadline, producing an error every millisecond. Throw on timeout using monotonic elapsed time, retain STOPPING, and emit one bounded diagnostic with the loop, elapsed time, stopper and owned-thread stacks. Interruption retains its status; a failed callback remains visible to later callers.

Stop before entering AbstractCloseable's close machinery, which otherwise swallows the failure, marks the loop closed and can release its handlers. A failed wait leaves ownership intact; once the original stop finishes, normal close can complete. The deadline bounds secondary waits; it cannot forcibly complete an application stop callback.

Keep the clock, deadline, stopping thread and failure bookkeeping transient so reflective Wire marshalling retains the existing event-group configuration representation.

Regression coverage exercises normal/repeated and concurrent stop, expiry through stop and close, interruption, callback failure, bounded diagnostics and eventual cleanup. The downstream MarshallingEventGroupTest covers the configuration representation. Contract and diagnostic limits are documented in src/main/docs/bounded-termination.adoc. Validation results remain local.

The secondary shutdown waiter logged indefinitely after its deadline. Fail with one diagnostic using monotonic elapsed time, keep STOPPING truthful, and surface stop failure before AbstractCloseable can mark a live loop closed. Regression controls exercise expiry, interruption, callback failure and concurrent stop.
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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.

1 participant