Project

General

Profile

Actions

Bug #9168

closed
VJ VJ

stats: race condition causes missing stats in short pcap runs

Bug #9168: stats: race condition causes missing stats in short pcap runs

Added by Victor Julien 8 days ago. Updated 4 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

Description

Under heavy thread oversubscription, a management thread can be descheduled for the whole lifetime of a short offline (pcap-file) run. The window is narrow: the thread enters the initial pause and then loses the CPU until shutdown has already started. Threads are created paused (THV_PAUSE) and the main thread unpauses them at post-init; a management thread that has not been scheduled yet spins in TmThreadsWaitForUnpause(). If the run finishes before that thread is scheduled again, the shutdown path sets THV_KILL while the thread is still in the initial pause. TmThreadsWaitForUnpause() then returned false, and the thread skipped its main loop entirely.

For the stats management thread this means no final StatsOutput() call: the last stats event is never written to eve.json, and the shutdown summary reports Alerts: 0 while all other output is correct. This makes the failure look like a stats accounting problem rather than a thread that never ran.

Reproduction: 32-way oversubscription of short offline runs, about 1 failure in 6400 runs, with the failure signature matching exactly (the final stats event is absent).

Impact: intermittent failures in suricata-verify tests that assert on the final stats, a misleading shutdown summary, and a silently missing final stats record in eve.json.


Subtasks 1 (0 open — 1 closed)

Bug #9169: stats: race condition causes missing stats in short pcap runs (8.0.x backport)ClosedVictor JulienActions

OT Updated by OISF Ticketbot 8 days ago Actions #1

  • Subtask #9169 added

OT Updated by OISF Ticketbot 8 days ago Actions #2

  • Label deleted (Needs backport to 8.0)

VJ Updated by Victor Julien 8 days ago Actions #3

  • Status changed from In Progress to In Review

JI Updated by Jason Ish 4 days ago Actions #4

  • Status changed from In Review to Closed

PR merged.

Actions

Also available in: PDF Atom