Skip to content

Guard msg_id() against UninitializedMemory + add cross-process grow test - #256

Merged
griffinmilsap merged 1 commit into
fix/channel-failure-on-shm-resizefrom
cboulay/shm-uninitialized-guards
Aug 10, 2026
Merged

Guard msg_id() against UninitializedMemory + add cross-process grow test#256
griffinmilsap merged 1 commit into
fix/channel-failure-on-shm-resizefrom
cboulay/shm-uninitialized-guards

Conversation

@griffinmilsap

Copy link
Copy Markdown
Collaborator

On top of #254: the two MessageMarshal.msg_id() call sites in the resize path (repopulate loop and the buffer-id check) can hit a slot that is uninitialized after a mid-stream resize. msg_id() calls _assert_initialized() and raises UninitializedMemory there, which would escape the receive loop and kill the channel task -- the exact failure #254 is closing. Guard both sites: treat uninitialized as skip/mismatch (drop + release backpressure).

Add tests/test_shm_grow.py: a parametrized real cross-process pub/sub with small buf_size and mid-stream oversized messages (single grow, two successive grows, grow-on-first-message), asserting every message is delivered. Complements the existing shm_resize_race_runner repro.

On top of #254: the two MessageMarshal.msg_id() call sites in the resize
path (repopulate loop and the buffer-id check) can hit a slot that is
uninitialized after a mid-stream resize. msg_id() calls
_assert_initialized() and raises UninitializedMemory there, which would
escape the receive loop and kill the channel task -- the exact failure
#254 is closing. Guard both sites: treat uninitialized as skip/mismatch
(drop + release backpressure).

Add tests/test_shm_grow.py: a parametrized real cross-process pub/sub
with small buf_size and mid-stream oversized messages (single grow,
two successive grows, grow-on-first-message), asserting every message is
delivered. Complements the existing shm_resize_race_runner repro.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@griffinmilsap
griffinmilsap merged commit a032a02 into fix/channel-failure-on-shm-resize Aug 10, 2026
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.

2 participants