Project

General

Profile

Actions

Bug #8259

closed
JI JI

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

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

Added by Jason Ish 2 months ago. Updated about 1 month 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

OT Updated by OISF Ticketbot 2 months ago Actions #1

  • Subtask #8260 added

OT Updated by OISF Ticketbot 2 months ago Actions #2

  • Label deleted (Needs backport to 8.0)

JI Updated by Jason Ish about 2 months ago Actions #3

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

JI Updated by Jason Ish about 1 month ago Actions #4

  • Status changed from In Progress to In Review

PA Updated by Philippe Antoine about 1 month ago Actions #5

  • Status changed from In Review to Resolved

JI Updated by Jason Ish about 1 month ago Actions #6

  • Status changed from Resolved to Closed
Actions

Also available in: PDF Atom