Skip to content

app-server: track idle thread teardown#31395

Open
winston-openai wants to merge 1 commit into
dev/winston/app-server-resume-idle-admissionfrom
dev/winston/app-server-idle-teardown-owner
Open

app-server: track idle thread teardown#31395
winston-openai wants to merge 1 commit into
dev/winston/app-server-resume-idle-admissionfrom
dev/winston/app-server-idle-teardown-owner

Conversation

@winston-openai

Copy link
Copy Markdown
Contributor

Summary

Replace the idle-unload marker set and detached teardown task with a tracked singleflight coordinator. A claim is registered together with its tracked supervisor, owns an exact completion channel, rolls back when a provisional claim is dropped, and remains visible until that owner finishes or unwinds.

The idle listener now hands shutdown to the tracked owner, removes and waits for the exact listener generation, and lets the coordinator release the claim. Graceful and in-process shutdown clear listeners, drain owned teardowns, and only then shut down remaining threads. Forced restart retains its existing non-blocking behavior.

This makes idle teardown survive cancellation of its first waiter without allowing an older owner to clear a replacement claim. Manual cleanup no longer mutates coordinator ownership; its remaining paths are migrated in the next stacked layer.

Stacked on #31392.

Validation

  • Coordinator coverage exercises provisional rollback, singleflight joining, first-waiter cancellation, and graceful drain.
  • Focused lifecycle tests cover resume reservations against tracked idle unload.
  • Existing public running-resume, unsubscribe, and listener/thread-state tests pass through the updated ownership path.

@winston-openai

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 2cf1e9dd69

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

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