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/parsers): call immediately call on_erase_fd callback #2256

Closed

Conversation

therealbobo
Copy link
Contributor

@therealbobo therealbobo commented Jan 23, 2025

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind feature

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area API-version

/area build

/area CI

/area driver-kmod

/area driver-bpf

/area driver-modern-bpf

/area libscap-engine-bpf

/area libscap-engine-gvisor

/area libscap-engine-kmod

/area libscap-engine-modern-bpf

/area libscap-engine-nodriver

/area libscap-engine-noop

/area libscap-engine-source-plugin

/area libscap-engine-savefile

/area libscap

/area libpman

/area libsinsp

/area tests

/area proposals

Does this PR require a change in the driver versions?

/version driver-API-version-major

/version driver-API-version-minor

/version driver-API-version-patch

/version driver-SCHEMA-version-major

/version driver-SCHEMA-version-minor

/version driver-SCHEMA-version-patch

What this PR does / why we need it:

Sadly the m_tinfo and m_fdinfo members could outlive the callback. This fixes it calling it immediately making sure that are alive.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@poiana
Copy link
Contributor

poiana commented Jan 23, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: therealbobo
Once this PR has been reviewed and has the lgtm label, please assign leogr for approval. For more information see the Kubernetes Code Review Process.

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

Needs approval from an approver in each of these files:

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

@poiana poiana requested review from gnosek and hbrueckner January 23, 2025 18:43
@poiana poiana added the size/S label Jan 23, 2025
Copy link

github-actions bot commented Jan 23, 2025

Perf diff from master - unit tests

    10.74%     -0.97%  [.] sinsp_parser::reset
     5.30%     +0.76%  [.] next_event_from_file
    10.58%     -0.57%  [.] sinsp::next
     8.16%     -0.56%  [.] sinsp_evt::get_type
     3.16%     -0.50%  [.] sinsp_thread_manager::get_thread_ref
     1.78%     +0.38%  [.] std::_Hashtable<unsigned long, std::pair<unsigned long const, std::shared_ptr<ppm_evt_hdr> >, std::allocator<std::pair<unsigned long const, std::shared_ptr<ppm_evt_hdr> > >, std::__detail::_Select1st, std::equal_to<unsigned long>, std::hash<unsigned 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
     0.92%     +0.34%  [.] 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> >::find
     0.17%     +0.30%  [.] sinsp_threadinfo::get_fd
     2.89%     -0.29%  [.] sinsp_parser::process_event
     1.69%     -0.28%  [.] sinsp_evt_filter::sinsp_evt_filter

Heap diff from master - unit tests

peak heap memory consumption: 0B
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.0056         -0.0056           144           143           144           143
BM_sinsp_split_median                                          -0.0127         -0.0127           144           142           144           142
BM_sinsp_split_stddev                                          +1.4880         +1.4869             1             2             1             2
BM_sinsp_split_cv                                              +1.5021         +1.5010             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  -0.0161         -0.0161            57            56            57            56
BM_sinsp_concatenate_paths_relative_path_median                -0.0157         -0.0156            57            56            57            56
BM_sinsp_concatenate_paths_relative_path_stddev                -0.5616         -0.5635             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_cv                    -0.5544         -0.5563             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     -0.0310         -0.0310            25            24            25            24
BM_sinsp_concatenate_paths_empty_path_median                   -0.0300         -0.0300            25            24            25            24
BM_sinsp_concatenate_paths_empty_path_stddev                   -0.1587         -0.1589             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       -0.1318         -0.1320             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  -0.0029         -0.0029            56            56            56            56
BM_sinsp_concatenate_paths_absolute_path_median                -0.0014         -0.0014            56            56            56            56
BM_sinsp_concatenate_paths_absolute_path_stddev                -0.2097         -0.2095             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_cv                    -0.2073         -0.2072             0             0             0             0
BM_sinsp_split_container_image_mean                            +0.0081         +0.0081           389           392           389           392
BM_sinsp_split_container_image_median                          +0.0081         +0.0081           389           392           389           392
BM_sinsp_split_container_image_stddev                          -0.0477         -0.0480             3             3             3             3
BM_sinsp_split_container_image_cv                              -0.0553         -0.0556             0             0             0             0

Copy link

codecov bot commented Jan 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.16%. Comparing base (6c46ed3) to head (8d9b144).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2256      +/-   ##
==========================================
- Coverage   75.16%   75.16%   -0.01%     
==========================================
  Files         278      278              
  Lines       34478    34469       -9     
  Branches     5922     5923       +1     
==========================================
- Hits        25916    25907       -9     
  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.

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.

2 participants