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

Optimization 4427 v2 #6057

Closed
wants to merge 6 commits into from
Closed

Conversation

jufajardini
Copy link
Contributor

Make sure these boxes are signed before submitting your Pull Request -- thank you.

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

Previous PR: #6056

Describe changes:

  • Incorporate Jeff's feedback.
  • Fix typo in a different commit (and also a formatting issue that showed up later)
  • Delete commented-out unused code lines.

From previous PR:

  • ebpf/util: use dedicated 'id' type for flow storage as well
  • device/storage: use dedicated 'id' type
  • host/storage: use dedicated 'id' type
  • ippair/storage: use dedicated 'id' type

#suricata-verify-pr:
#suricata-verify-repo:
#suricata-verify-branch:
#suricata-update-pr:
#suricata-update-repo:
#suricata-update-branch:
#libhtp-pr:
#libhtp-repo:
#libhtp-branch:

- Wrap the id in a new IPPairStorageId struct, to avoid id
confusion with other storage API calls.
- Formatting fixes by clang.
- Wrap the id in a HostStorageId struct to avoid id confusion
with other storage API calls.
- Fix formatting with clang script.
- Wrap the id in a new LiveDevStorageId struct, to avoid id
 confusion with other storage API calls.
- Formatting fixes by clang.
@jufajardini jufajardini requested a review from a team as a code owner April 14, 2021 22:28
@jufajardini jufajardini mentioned this pull request Apr 14, 2021
3 tasks
@codecov
Copy link

codecov bot commented Apr 14, 2021

Codecov Report

Merging #6057 (3f21b8c) into master (bc667a4) will decrease coverage by 0.05%.
The diff coverage is 78.48%.

@@            Coverage Diff             @@
##           master    #6057      +/-   ##
==========================================
- Coverage   76.99%   76.94%   -0.06%     
==========================================
  Files         612      612              
  Lines      187752   187758       +6     
==========================================
- Hits       144569   144474      -95     
- Misses      43183    43284     +101     
Flag Coverage Δ
fuzzcorpus 52.87% <33.33%> (-0.11%) ⬇️
suricata-verify 50.25% <46.00%> (-0.04%) ⬇️
unittests 63.23% <74.35%> (-0.01%) ⬇️

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

This was referenced Apr 15, 2021
static int g_livedev_storage_id = -1;
static int g_flow_storage_id = -1;
static LiveDevStorageId g_livedev_storage_id = { .id = -1 };
static StorageFlowId g_flow_storage_id = { .id = -1 };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: should be FlowStorageId instead (I fixed this up in my merge)

@victorjulien
Copy link
Member

Merged in #6059, thanks!

@jufajardini jufajardini deleted the optimization-4427-v2 branch April 16, 2021 09:18
jasonish added a commit to jasonish/suricata that referenced this pull request May 9, 2023
Convert "new_object" and "new_array" functions that return a Result
and use "try_reserve" to allocate the amount of data requested. This
should allow memory allocation errors to be detected and handled in a
Rust-ful matter without resorting to catching a panic.

Ticket: OISF#6057
jasonish added a commit to jasonish/suricata that referenced this pull request May 9, 2023
Provide a wrapper around "push" and "push_str" on the internal buffer
that will "try_reserve" data before growing in an attempt to handle
memory allocation errors.

Ticket: OISF#6057
jasonish added a commit to jasonish/suricata that referenced this pull request May 9, 2023
Provide a wrapper around "push" and "push_str" on the internal buffer
that will "try_reserve" data before growing in an attempt to handle
memory allocation errors.

Ticket: OISF#6057
jasonish added a commit to jasonish/suricata that referenced this pull request May 16, 2023
Convert "new_object" and "new_array" functions that return a Result
and use "try_reserve" to allocate the amount of data requested. This
should allow memory allocation errors to be detected and handled in a
Rust-ful matter without resorting to catching a panic.

Ticket: OISF#6057
jasonish added a commit to jasonish/suricata that referenced this pull request May 16, 2023
Provide a wrapper around "push" and "push_str" on the internal buffer
that will "try_reserve" data before growing in an attempt to handle
memory allocation errors.

Ticket: OISF#6057
jasonish added a commit to jasonish/suricata that referenced this pull request May 18, 2023
Convert "new_object" and "new_array" functions that return a Result
and use "try_reserve" to allocate the amount of data requested. This
should allow memory allocation errors to be detected and handled in a
Rust-ful matter without resorting to catching a panic.

Ticket: OISF#6057
jasonish added a commit to jasonish/suricata that referenced this pull request May 18, 2023
Before growing any buffers use try_reserve to reserve the space required
as this will return an error on allocation failures.

Ticket: OISF#6057
jasonish added a commit to jasonish/suricata that referenced this pull request May 19, 2023
Before growing any buffers use try_reserve to reserve the space required
as this will return an error on allocation failures.

Ticket: OISF#6057
jasonish added a commit to jasonish/suricata that referenced this pull request May 24, 2023
Use try_reserve before growing the internal buffer, and the internal
state vector. This allows allocation errors to be caught and an error
returned instead of just aborting the process.

Ticket: OISF#6057
jasonish added a commit to jasonish/suricata that referenced this pull request May 25, 2023
Use try_reserve before growing the internal buffer, and the internal
state vector. This allows allocation errors to be caught and an error
returned instead of just aborting the process.

Ticket: OISF#6057
jasonish added a commit to jasonish/suricata that referenced this pull request May 25, 2023
Use try_reserve before growing the internal buffer, and the internal
state vector. This allows allocation errors to be caught and an error
returned instead of just aborting the process.

Ticket: OISF#6057
victorjulien pushed a commit to victorjulien/suricata that referenced this pull request May 30, 2023
Use try_reserve before growing the internal buffer, and the internal
state vector. This allows allocation errors to be caught and an error
returned instead of just aborting the process.

Ticket: OISF#6057
zhiyuan-liao pushed a commit to zhiyuan-liao/suricata that referenced this pull request Jun 1, 2023
Use try_reserve before growing the internal buffer, and the internal
state vector. This allows allocation errors to be caught and an error
returned instead of just aborting the process.

Ticket: OISF#6057
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants