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

fix(libsinsp): solve field-field comparison pointer instability issues #2063

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

jasondellaluce
Copy link
Contributor

What type of PR is this?

/kind bug

Any specific area of the project related to this PR?

/area libsinsp

Does this PR require a change in the driver versions?

What this PR does / why we need it:

Internal tests demonstrated that field-to-field comparisons and/or filter caching can't just be broken with plugin fields (for which we enforced a STORAGE transformer layer in the compiler), but also with other fields were pointer stability between subsequent extractions on the same events (even on different fields) is not guaranteed.

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

fix(libsinsp): solve field-field comparison pointer instability issues 

Copy link

Perf diff from master - unit tests

     5.65%     +1.85%  [.] sinsp::next
     2.15%     -0.89%  [.] std::_Hashtable<long, std::pair<long const, std::shared_ptr<sinsp_threadinfo> >, std::allocator<std::pair<long const, std::shared_ptr<sinsp_threadinfo> > >, std::__detail::_Select1st, std::equal_to<long>, std::hash<long>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_find_before_node
     5.00%     -0.84%  [.] sinsp_evt::load_params
     2.91%     -0.76%  [.] scap_event_decode_params
     5.56%     -0.71%  [.] next
     1.50%     -0.69%  [.] std::vector<sinsp_evt_param, std::allocator<sinsp_evt_param> >::emplace_back<sinsp_evt*, unsigned int&, char const*, unsigned long&>
     1.34%     +0.45%  [.] sinsp_parser::event_cleanup
     0.79%     +0.44%  [.] sinsp_filter_check::parse_field_name
     1.46%     -0.40%  [.] libsinsp::events::is_unknown_event
     0.81%     -0.40%  [.] sinsp_fdtable::find

Heap diff from master - unit tests

peak heap memory consumption: -419B
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

Heap diff from master - scap file

peak heap memory consumption: 0B
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

Benchmarks diff from master

Comparing gbench_data.json to /root/actions-runner/_work/libs/libs/build/gbench_data.json
Benchmark                                                         Time             CPU      Time Old      Time New       CPU Old       CPU New
----------------------------------------------------------------------------------------------------------------------------------------------
BM_sinsp_split_mean                                            +0.0066         +0.0066           149           150           149           150
BM_sinsp_split_median                                          +0.0079         +0.0079           149           150           149           150
BM_sinsp_split_stddev                                          -0.1837         -0.1851             1             1             1             1
BM_sinsp_split_cv                                              -0.1890         -0.1905             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  -0.0929         -0.0929            47            42            47            42
BM_sinsp_concatenate_paths_relative_path_median                -0.0913         -0.0913            46            42            46            42
BM_sinsp_concatenate_paths_relative_path_stddev                -0.6232         -0.6243             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_cv                    -0.5846         -0.5858             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     -0.0063         -0.0063            17            17            17            17
BM_sinsp_concatenate_paths_empty_path_median                   -0.0019         -0.0019            17            17            17            17
BM_sinsp_concatenate_paths_empty_path_stddev                   -0.4590         -0.4588             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       -0.4556         -0.4554             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  -0.1035         -0.1035            50            45            50            45
BM_sinsp_concatenate_paths_absolute_path_median                -0.1012         -0.1011            50            45            50            45
BM_sinsp_concatenate_paths_absolute_path_stddev                -0.6171         -0.6169             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_cv                    -0.5729         -0.5726             0             0             0             0
BM_sinsp_split_container_image_mean                            -0.0055         -0.0055           353           351           353           351
BM_sinsp_split_container_image_median                          +0.0009         +0.0009           350           351           350           351
BM_sinsp_split_container_image_stddev                          -0.5791         -0.5787             4             2             4             2
BM_sinsp_split_container_image_cv                              -0.5768         -0.5763             0             0             0             0

Copy link

codecov bot commented Sep 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.58%. Comparing base (5b9db23) to head (f851ffb).
Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2063      +/-   ##
==========================================
+ Coverage   73.55%   73.58%   +0.02%     
==========================================
  Files         253      253              
  Lines       31863    31867       +4     
  Branches     5651     5656       +5     
==========================================
+ Hits        23438    23450      +12     
+ Misses       8420     8417       -3     
+ Partials        5        0       -5     
Flag Coverage Δ
libsinsp 73.58% <100.00%> (+0.02%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@FedeDP
Copy link
Contributor

FedeDP commented Sep 13, 2024

/milestone 0.18.0

@poiana poiana added this to the 0.18.0 milestone Sep 13, 2024
Copy link
Contributor

@FedeDP FedeDP left a comment

Choose a reason for hiding this comment

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

/approve

@poiana
Copy link
Contributor

poiana commented Sep 13, 2024

LGTM label has been added.

Git tree hash: c626582e698d97a96047ae1299d8a602e1736f97

@poiana
Copy link
Contributor

poiana commented Sep 13, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FedeDP, jasondellaluce

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [FedeDP,jasondellaluce]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana merged commit 289bb6e into master Sep 13, 2024
47 checks passed
@poiana poiana deleted the fix/val-to-val-comparisons branch September 13, 2024 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants