Fix silent message loss: globally unique Nats-Msg-Id (2.2.1 hotfix) - #39
Merged
Merged
Conversation
…Msg-Id globally unique
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.
Fixes #38.
2.2.0 uses
meta.idas the JetStreamNats-Msg-Id— butgen_idis process-locally sequential, so ids collide across processes and restarts on any shared stream, and JetStream silently drops the later publishes as duplicates (verified:PubAck.duplicate=Truefor a different subject of the same stream).Fix: dedup header becomes
<instance>:<meta.id>with a random per-process token generated once perMessenger. Ack-timeout retries still reuse the identical header (the #18 protection stays intact); cross-process/restart collisions are impossible. Message envelope unchanged.Tests: new
test_publish_no_cross_process_dedup_collision(forced same meta.id from a simulated foreign process — both messages must be stored) + updated header assertions. Full suite: 311 passed, 8 skipped, 1 xfailed.Deployment note: all services running 2.2.0 (ofp, tcs, halina) should upgrade promptly — the bug is silent data loss on shared streams.
🤖 Generated with Claude Code
https://claude.ai/code/session_01HfMGwatJe81U9aekr51R7f