You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 22dedae
Browse filesBrowse the repository at this point in the historyBrowse files
Synchronise the endpoint stats between the capture and stats threads
The stats thread walked syn_tab and read every query_stats in it while
the capture thread was inserting endpoints and bumping counters, with
nothing between them. Replaying a 16000 packet capture while polling
the stats endpoint reports six data races under ThreadSanitizer and
aborts: in stats_incr, in create_stats_object and on srv->stopped.
- Add stats_lock to the sniffer, held by the capture thread around
every syn_tab lookup, insert and counter update, and by the stats
thread across the whole walk so a response cannot be counted half
way through serialisation. The requests table stays lock free: only
the capture thread touches it.
- srv->stopped is written by server_terminate, which also runs from
the signal handler, and read by the stats thread's loop. It is now
sig_atomic_t accessed through the compiler's atomic builtins.
- Skip the endpoint instead of dereferencing NULL when the calloc for
a new query_stats fails.
`make test-race` rebuilds under ThreadSanitizer and replays a generated
stress capture while polling the endpoint; it reports 0 races where the
previous code reported 6. It is opt-in because it clobbers the ordinary
build, and runs as its own CI job.
Assistant By Opus 5
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments