Repository navigation
Close the snapshot store off the runtime; release v0.8.4 - #31
Merged
Merged
Conversation
watch_applied dropped its store wherever the loop exited, on the tokio worker. fjall 3.1.x's Database::drop can deadlock joining its worker pool (a blocking send(Close) into its full channel after the last worker exits), and on a single-worker runtime (a CPUQuota=100% service) that froze the whole process: instd stopped pulling NATS, logging and handling signals after a KV-watch heartbeat miss, and never reached the error path that restarts it. The loop now only borrows the fold; on every exit the store is dropped on a dedicated thread and the return waits up to 30s for it. A normal close still completes before return, so callers can reopen the path; a hung close leaves its thread behind instead of the runtime. A std thread, not spawn_blocking, since runtime shutdown waits on blocking tasks. Release 0.8.4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XoaQgogNq1z3dNoM9feGoH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
watch_applieddropped its snapshot store on the tokio worker wherever the loop exited. fjall 3.1.x'sDatabase::dropcan deadlock while joining its worker pool: a blockingsend(Close)into a full channel after the last worker has exited. On a single-worker runtime, which is what aCPUQuota=100%service gets, that froze the whole process. In production, instd stopped pulling NATS, logging and handling SIGTERM after a KV-watch heartbeat miss, and never reached the error path that restarts it. gdb on the wedged process showed fjall's thread counter at 0, the channel at 1000/1000, one parked sender and no worker threads. fjall 3.1.12 still has the sameDrop.Change
OkorErr), the store is dropped on a dedicated thread, andwatch_appliedwaits up to 30s for that close before returning.spawn_blocking, because runtime shutdown waits on blocking tasks and would just move the hang to process exit.ARCHITECTURE.mdand thewatch_applieddocs describe the new close behavior.Tests
a_store_that_hangs_on_close_cannot_freeze_the_runtimeruns on a current-thread runtime. Against the pre-fix code it hangs (killed at 30s); with the fix it passes.the_store_is_closed_before_watch_applied_returnschecks that a normal close completes before the return.🤖 Generated with Claude Code
https://claude.ai/code/session_01XoaQgogNq1z3dNoM9feGoH