Skip to content

Various bug fixes for the queue submodule - #10

Merged
Tapanhaz merged 32 commits into
mainfrom
queue_fix
Jul 16, 2026
Merged

Tapanhaz merged 32 commits into
mainfrom
queue_fix

Conversation

@Tapanhaz

Copy link
Copy Markdown
Owner
  • queue_close

    • Fixed stale snapshot (reg_mask / drain_target) race .
    • Fixed MPSC publish-drain logic not looping back to consume newly published entries.
    • Extended the same fix to the MPMC implementation.
  • SPSC

    • Fixed post-release reads of slot.total_chunks in spsc_pop_var() and spsc_try_pop_var() (read-after-release race).
  • MPSC

    • Fixed the two-separate-release-stores gap in mpsc_pop() (head vs publish[idx].seq reorder issue).
  • Synchronization

    • Made queue flags atomic (uint8_tatomic<uint8_t>), eliminating a plain-field data race.
  • Memory Layout

    • Removed redundant manual padding since adjacent alignas(CACHELINE) members already provide the required cache-line separation.
    • Changed reader_active_mask to PaddedAtomicU64 to eliminate false-sharing risk.
    • Converted reader_pos[64] and consumer_ctx[64] to padded, cacheline-safe types.
    • Reworked PublishEntry into a properly aligned alignas(CACHELINE) C++ structure instead of relying on manual padding.
  • Initialization API

    • Added low-level queue_init() and queue_destroy() APIs .

    • Simplified Queue.__cinit__(), Queue.__init__(), and Queue.__dealloc__() by delegating initialization and cleanup to queue_init() and queue_destroy().

Tapanhaz added 30 commits June 28, 2026 20:52
@Tapanhaz

Copy link
Copy Markdown
Owner Author

I'm not sure what's causing the CI failure on the Ubuntu 26.04 runner. I reproduced the environment locally using an Ubuntu 26.04 Docker container, and all tests passed successfully.

For now, I'm switching the workflow back to the Ubuntu 24.04 runner so this PR can be merged. I'll investigate the 26.04 runner issue separately in a follow-up.

@Tapanhaz
Tapanhaz merged commit 183c810 into main Jul 16, 2026
3 checks passed
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