Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datasets locking/v10 #12570

Closed
wants to merge 4 commits into from
Closed

Conversation

inashivb
Copy link
Member

Link to ticket: https://redmine.openinfosecfoundation.org/issues/7398

Previous PR: #12564

Changes since v9:

  • renamed var and cleaned up code as per review

SV_BRANCH=OISF/suricata-verify#2287

In a recent warning reported by scan-build, datasets were found to be
using a blocking call in a critical section.

datasets.c:187:12: warning: Call to blocking function 'fgets' inside of critical section [unix.BlockInCriticalSection]
  187 |     while (fgets(line, (int)sizeof(line), fp) != NULL) {
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
datasets.c:292:12: warning: Call to blocking function 'fgets' inside of critical section [unix.BlockInCriticalSection]
  292 |     while (fgets(line, (int)sizeof(line), fp) != NULL) {
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
datasets.c:368:12: warning: Call to blocking function 'fgets' inside of critical section [unix.BlockInCriticalSection]
  368 |     while (fgets(line, (int)sizeof(line), fp) != NULL) {
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
datasets.c:442:12: warning: Call to blocking function 'fgets' inside of critical section [unix.BlockInCriticalSection]
  442 |     while (fgets(line, (int)sizeof(line), fp) != NULL) {
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
datasets.c:512:12: warning: Call to blocking function 'fgets' inside of critical section [unix.BlockInCriticalSection]
  512 |     while (fgets(line, (int)sizeof(line), fp) != NULL) {
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 warnings generated.

These calls are blocking in the multi tenant mode where several tenants
may be trying to load the same dataset in parallel.
In a single tenant mode, this operation is performed as a part of a
single thread before the engine startup.

In order to evade the warning and simplify the code, the initial file
reading is moved to Rust with this commit with a much simpler handling
of dataset and datarep.

Bug 7398
Copy link

codecov bot commented Feb 13, 2025

Codecov Report

Attention: Patch coverage is 77.52294% with 49 lines in your changes missing coverage. Please review.

Project coverage is 80.72%. Comparing base (0165830) to head (c73504d).
Report is 24 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12570      +/-   ##
==========================================
+ Coverage   80.70%   80.72%   +0.02%     
==========================================
  Files         928      929       +1     
  Lines      259013   259000      -13     
==========================================
+ Hits       209033   209090      +57     
+ Misses      49980    49910      -70     
Flag Coverage Δ
fuzzcorpus 56.99% <20.18%> (+0.03%) ⬆️
livemode 19.40% <0.00%> (+<0.01%) ⬆️
pcap 44.22% <0.45%> (+0.03%) ⬆️
suricata-verify 63.42% <79.34%> (+0.02%) ⬆️
unittests 58.38% <0.45%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@suricata-qa
Copy link

WARNING:

field baseline test %
SURI_TLPR1_stats_chk
.uptime 636 659 103.62%

Pipeline 24712

@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 24715

@inashivb inashivb added the needs rebase Needs rebase to master label Feb 14, 2025
@inashivb inashivb mentioned this pull request Feb 14, 2025
@inashivb inashivb closed this Feb 14, 2025
@inashivb inashivb deleted the datasets-locking/v10 branch February 14, 2025 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs rebase Needs rebase to master
Development

Successfully merging this pull request may close these issues.

4 participants