Skip to content

fix(api-rest): clear database routing context across request lifecycles - #968

Draft
srreejitbarat wants to merge 4 commits into
9tigerio:masterfrom
srreejitbarat:fix/database-context-cleanup
Draft

srreejitbarat wants to merge 4 commits into
9tigerio:masterfrom
srreejitbarat:fix/database-context-cleanup

Conversation

@srreejitbarat

@srreejitbarat srreejitbarat commented Oct 15, 2026 •

Copy link
Copy Markdown

When a controller throws or starts asynchronous handling, postHandle is skipped and the database ID can remain on a reused servlet thread. A later whitelist/admin request can inherit that route.

This clears stale context before route validation, performs synchronous cleanup in afterCompletion, and releases context at afterConcurrentHandlingStarted. Async redispatch establishes its own route; worker services continue selecting JDBC/transaction templates with explicit dbId. Invalid-route diagnostics no longer log request paths or database IDs.

Refs #958.

Validation — 16 October 2026:

The new upstream workflow requires maintainer approval: https://github.com/9tigerio/db2rest/actions/runs/38851879422 . The successful fork build does not replace that required check.

Draft pending maintainer review and upstream workflow approval. The timeout regression models a deferred timeout result and redispatch rather than a real container timer. The context-consumer inventory and reproduction notes are in design/database-context-lifecycle.md.

AI assistance was used for implementation, tests and documentation.

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