Skip to content

Finish CodeContext cleanup after disposer failures - #139

Open
RichardHoekstra wants to merge 1 commit into
WebHare:mainfrom
RichardHoekstra:github/fix/context-disposal-failures
Open

RichardHoekstra wants to merge 1 commit into
WebHare:mainfrom
RichardHoekstra:github/fix/context-disposal-failures

Conversation

@RichardHoekstra

Copy link
Copy Markdown
Contributor

Problem

A throwing listener or disposer aborts CodeContext.close() before later resources are disposed and the context is closed. Concurrent callers can dispose resources independently.

Change

Share one close promise, attempt all cleanup, preserve failures, then clear storage and mark the context closed. Cleanup retains scoped-resource access until disposal finishes.

Validation

system.nodejs.test_codecontext_cleanup fails before and passes after. Seven regressions cover listener/disposer failures, error aggregation, concurrent close, inherited callbacks and PostgreSQL lock release.

Selected compatibility, TypeScript and unchanged ESLint checks pass.

Compatibility

One failure is preserved unchanged; multiple failures produce an AggregateError. This adds no forced cancellation or cleanup deadline.

Validated on the official 6.2 image for GitHub main a91a7a28, with the candidate sources installed. Full upstream CI has not been run.

@RichardHoekstra
RichardHoekstra requested a review from a team October 27, 2026 15:41

This branch was successfully deployed

1 active deployment
external-ci — 706b2609 Deployed Oct 27, 2026 by RichardHoekstra via setup #202
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