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/v6 #12361

Closed
wants to merge 4 commits into from
Closed

Conversation

inashivb
Copy link
Member

@inashivb inashivb commented Jan 9, 2025

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

Previous PR: #12334

Changes since v5:

  • error on mixing dataset and daterep values
  • better handling for string unwraps
  • more desciptive error messages
  • callback for FatalErrorOnInit
  • better naming schemes
  • rebased on top of latest master

SV_BRANCH=OISF/suricata-verify#2223

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
@inashivb inashivb force-pushed the datasets-locking/v6 branch from 5865684 to 2f18f59 Compare January 9, 2025 07:10
Copy link

codecov bot commented Jan 9, 2025

Codecov Report

Attention: Patch coverage is 88.00000% with 12 lines in your changes missing coverage. Please review.

Project coverage is 82.50%. Comparing base (494d7bf) to head (2f18f59).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12361      +/-   ##
==========================================
- Coverage   82.54%   82.50%   -0.04%     
==========================================
  Files         912      913       +1     
  Lines      258028   258073      +45     
==========================================
- Hits       212988   212932      -56     
- Misses      45040    45141     +101     
Flag Coverage Δ
fuzzcorpus 60.56% <25.00%> (-0.16%) ⬇️
livemode 19.39% <0.00%> (-0.01%) ⬇️
pcap 44.43% <0.00%> (+<0.01%) ⬆️
suricata-verify 63.23% <98.87%> (+0.04%) ⬆️
unittests 58.10% <0.00%> (-0.02%) ⬇️

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

@victorjulien
Copy link
Member

Attention: Patch coverage is 61.00000% with 39 lines in your changes missing coverage. Please review.

Coverage is quite low. Can you investigate why?

@inashivb
Copy link
Member Author

inashivb commented Jan 9, 2025

Attention: Patch coverage is 61.00000% with 39 lines in your changes missing coverage. Please review.

Coverage is quite low. Can you investigate why?

All error conditions, it seems that are not already covered by our test suite. I can craft tests for some.

@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 24129

@inashivb inashivb mentioned this pull request Jan 9, 2025
@inashivb inashivb closed this Jan 9, 2025
@inashivb inashivb deleted the datasets-locking/v6 branch January 9, 2025 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants