fix(kernel): handle messages in queue after kernel restart#611
Merged
fix(kernel): handle messages in queue after kernel restart#611
Conversation
grypez
reviewed
Aug 28, 2025
| await kernel1.stop(); | ||
| // verify that the message is in the database | ||
| expect(kernelStore.kv.get('queue.run.3')).toBeDefined(); | ||
| await kernel1.stop(); |
Contributor
There was a problem hiding this comment.
Why does reading this queue item from the kernel store not work after the kernel stops?
Contributor
Author
There was a problem hiding this comment.
It does work actually. I just wanted to show the state after the kernel has stopped.
grypez
approved these changes
Aug 28, 2025
Contributor
grypez
left a comment
There was a problem hiding this comment.
Order must be maintained.
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.
This PR addresses a race condition in kernel initialization where the run queue would start processing messages before all vats were fully initialized, potentially causing messages to fail when sent to vats that weren't ready yet.
The key change reorders the initialization sequence:
This prevents the queue processor from attempting to deliver messages to vats that haven't been fully initialized yet, which was causing intermittent failures in scenarios involving kernel restarts with pending messages.
Added a new test that verifies the kernel correctly processes messages that were enqueued in the database before a restart. The test manually injects a message into the run queue storage, restarts the kernel, and confirms the message is processed correctly with the expected counter increment.