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): do not invalidate thread manager cache when using plugin state api #2257

Merged
merged 2 commits into from
Jan 24, 2025

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:

During an investigation, we discovered an issue with the accessors used by plugins and the internal state api for retrieving thread infos from the state tables. By not declaring the access as "lookup only", plugins have the potential of invalidating the thread manager cache and potentially lead to invalidating the raw threadinfo pointer assigned to the parsed event, thus violating the internal threadinfo ownership/liveness guarantees.

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

LucaGuerra
LucaGuerra previously approved these changes Jan 24, 2025
@poiana
Copy link
Contributor

poiana commented Jan 24, 2025

LGTM label has been added.

Git tree hash: 53e1f730ddf2e234e09a4cefc2c098d50faf6799

@leogr
Copy link
Member

leogr commented Jan 24, 2025

/milestone 0.21.0

@poiana poiana added this to the 0.21.0 milestone Jan 24, 2025
@poiana poiana added the lgtm label Jan 24, 2025
@poiana
Copy link
Contributor

poiana commented Jan 24, 2025

LGTM label has been added.

Git tree hash: b522a4ade8cf2d27003b6c32138a726a4d92e522

Copy link

Perf diff from master - unit tests

    10.57%     +1.33%  [.] sinsp::next
    10.73%     -1.03%  [.] sinsp_parser::reset
     5.29%     +0.63%  [.] next_event_from_file
     3.04%     -0.44%  [.] sinsp_thread_manager::find_thread
     3.79%     -0.37%  [.] sinsp_evt::load_params
     2.42%     -0.34%  [.] is_conversion_needed
     1.24%     +0.29%  [.] sinsp_evt::get_ts
     8.15%     -0.27%  [.] sinsp_evt::get_type
     0.88%     +0.26%  [.] sinsp_evt::get_syscall_return_value
     0.84%     -0.22%  [.] scap_next

Heap diff from master - unit tests

peak heap memory consumption: -5.18K
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.0511         +0.0510           144           152           144           152
BM_sinsp_split_median                                          +0.0530         +0.0529           144           152           144           152
BM_sinsp_split_stddev                                          +0.3591         +0.3594             1             1             1             1
BM_sinsp_split_cv                                              +0.2930         +0.2935             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  +0.1180         +0.1179            57            64            57            64
BM_sinsp_concatenate_paths_relative_path_median                +0.1179         +0.1178            57            64            57            64
BM_sinsp_concatenate_paths_relative_path_stddev                +0.2753         +0.2761             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_cv                    +0.1407         +0.1416             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     +0.0011         +0.0010            25            25            25            25
BM_sinsp_concatenate_paths_empty_path_median                   +0.0000         -0.0001            25            25            25            25
BM_sinsp_concatenate_paths_empty_path_stddev                   +0.2534         +0.2541             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       +0.2521         +0.2528             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  +0.1838         +0.1837            56            66            56            66
BM_sinsp_concatenate_paths_absolute_path_median                +0.1917         +0.1915            56            67            56            67
BM_sinsp_concatenate_paths_absolute_path_stddev                +1.1720         +1.1721             0             1             0             1
BM_sinsp_concatenate_paths_absolute_path_cv                    +0.8348         +0.8351             0             0             0             0
BM_sinsp_split_container_image_mean                            +0.0204         +0.0203           389           397           389           397
BM_sinsp_split_container_image_median                          +0.0199         +0.0198           389           397           389           397
BM_sinsp_split_container_image_stddev                          -0.0067         -0.0071             3             3             3             3
BM_sinsp_split_container_image_cv                              -0.0266         -0.0269             0             0             0             0

Copy link

codecov bot commented Jan 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.16%. Comparing base (6c46ed3) to head (b98b571).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2257   +/-   ##
=======================================
  Coverage   75.16%   75.16%           
=======================================
  Files         278      278           
  Lines       34478    34481    +3     
  Branches     5922     5923    +1     
=======================================
+ Hits        25916    25919    +3     
  Misses       8562     8562           
Flag Coverage Δ
libsinsp 75.16% <100.00%> (+<0.01%) ⬆️

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.

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 Jan 24, 2025

[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 b301787 into master Jan 24, 2025
49 checks passed
@poiana poiana deleted the jasondellaluce-patch-1 branch January 24, 2025 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants