Project

General

Profile

Actions

Bug #8259

closed

lib: examples fail with debug validation as they create threads after threads are sealed

Added by Jason Ish about 1 month ago. Updated 5 days ago.

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

Description

The Suricata "custom" lib example initializes ThreadVars after calling, SuricataInit, it does this as it initializes them as close as possible to creating the threads.

However, SuricataInit "seals" the threads and adds a debug validation. This fix is for:
- library users to setup their own custom run modes with RunModeRegisterNewRunMode and register a callback
- create the ThreadVars in this callback (optionally the threads could be created here as well)
- SuricataInit then runs this callback
- After SuricataInit, but before SuricataPostInit, the actual threads can be created, or the create ThreadVars could be injected into exist threads, etc.

This is all backportable to 8. However in main we can also remove:

RunModeRegisterNewRunMode(RUNMODE_LIB, "offline", ...);
RunModeRegisterNewRunMode(RUNMODE_LIB, "live", ...);

in runmode-lib.c, and force users to go through the custom runmode registration, which probably makes more sense anyways, at least with the current threading design.

Documentation should be updated to recommend this approach to users of the 8.o library.


Subtasks 1 (0 open1 closed)

Bug #8260: lib: examples fail with debug validation as they create threads after threads are sealed (8.0.x backport)ClosedJason IshActions

Related issues 1 (0 open1 closed)

Related to Suricata - Task #8096: libsuricata: add live example usage of the Suricata libraryClosedJason IshActions
Actions #1

Updated by OISF Ticketbot about 1 month ago

  • Subtask #8260 added
Actions #2

Updated by OISF Ticketbot about 1 month ago

  • Label deleted (Needs backport to 8.0)
Actions #3

Updated by Jason Ish 15 days ago

  • Related to Task #8096: libsuricata: add live example usage of the Suricata library added
Actions #4

Updated by Jason Ish 14 days ago

  • Status changed from In Progress to In Review
Actions #5

Updated by Philippe Antoine 6 days ago

  • Status changed from In Review to Resolved
Actions #6

Updated by Jason Ish 5 days ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF