Skip to content

fix(socketio): emit with ack race cond#708

Merged
Totodore merged 3 commits intomainfrom
fix-race-cond
Apr 12, 2026
Merged

fix(socketio): emit with ack race cond#708
Totodore merged 3 commits intomainfrom
fix-race-cond

Conversation

@Totodore
Copy link
Copy Markdown
Owner

@Totodore Totodore commented Apr 12, 2026

Motivation

With env with high CPU preemption (like CIs) a race condition might occur when using emit_with_ack methods. The ack oneshot chan was inserted in the pending acks map only after the packet emission. With a potential interrupt and a fast enough system the ack response was received before the chan being inserted in the map.

Solution

Insert the oneshot ack response handler before emitting the packet.

@Totodore Totodore added C-Bug Something isn't working A-socketioxide Area related to socketioxide labels Apr 12, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 12, 2026

Merging this PR will not alter performance

✅ 87 untouched benchmarks


Comparing fix-race-cond (602400c) with main (9fd9181)

Open in CodSpeed

@Totodore Totodore marked this pull request as ready for review April 12, 2026 08:56
@Totodore Totodore merged commit dd9d7fb into main Apr 12, 2026
19 checks passed
@Totodore Totodore deleted the fix-race-cond branch April 12, 2026 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-socketioxide Area related to socketioxide C-Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant