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

cleanup(sinsp): handle path too long in a better way #2160

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Andreagit97
Copy link
Member

What type of PR is this?

/kind cleanup

Any specific area of the project related to this PR?

/area libsinsp

Does this PR require a change in the driver versions?
No

What this PR does / why we need it:

Today in case of path is too long we return /PATH_TOO_LONG. This means:

  • fd_directory = "/"
  • fd_filename = "PATH_TOO_LONG"

The directory is definitely wrong and misleading as a workaround I propose something like this /DIR_TOO_LONG/FILENAME_TOO_LONG, so:

  • fd_directory = "/DIR_TOO_LONG"
  • fd_filename = "FILENAME_TOO_LONG"

We probably need to find something better but at least we remove the wrong dir

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@Andreagit97
Copy link
Member Author

not sure if 0.19.0 or 0.20.0, it should be quite safe

Copy link

Perf diff from master - unit tests

     3.23%     +0.71%  [.] sinsp_parser::process_event
     3.64%     -0.69%  [.] sinsp_thread_manager::find_thread
     1.02%     -0.56%  [.] std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, libsinsp::state::dynamic_struct::field_info>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, libsinsp::state::dynamic_struct::field_info> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_find_before_node
     1.03%     -0.48%  [.] sinsp_split[abi:cxx11]
     1.44%     -0.46%  [.] 0x00000000000ea364
     1.04%     -0.42%  [.] std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Identity, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, true, true> >::find
     3.90%     -0.40%  [.] gzfile_read
     2.29%     +0.40%  [.] scap_event_decode_params
     9.93%     +0.39%  [.] sinsp_parser::reset
     1.13%     -0.37%  [.] sinsp_evt::get_param

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.0130         -0.0130           146           144           146           144
BM_sinsp_split_median                                          -0.0136         -0.0136           146           144           146           144
BM_sinsp_split_stddev                                          +0.3044         +0.3049             1             1             1             1
BM_sinsp_split_cv                                              +0.3216         +0.3221             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  +0.0403         +0.0403            60            62            60            62
BM_sinsp_concatenate_paths_relative_path_median                +0.0391         +0.0391            60            62            60            62
BM_sinsp_concatenate_paths_relative_path_stddev                +1.4329         +1.4343             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_cv                    +1.3386         +1.3400             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     +0.0008         +0.0008            25            25            25            25
BM_sinsp_concatenate_paths_empty_path_median                   -0.0017         -0.0016            25            25            25            25
BM_sinsp_concatenate_paths_empty_path_stddev                   +0.8447         +0.8429             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       +0.8433         +0.8414             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  +0.0108         +0.0108            62            62            62            62
BM_sinsp_concatenate_paths_absolute_path_median                +0.0284         +0.0284            62            64            62            64
BM_sinsp_concatenate_paths_absolute_path_stddev                +0.8204         +0.8208             1             3             1             3
BM_sinsp_concatenate_paths_absolute_path_cv                    +0.8009         +0.8013             0             0             0             0
BM_sinsp_split_container_image_mean                            +0.0335         +0.0335           373           385           373           385
BM_sinsp_split_container_image_median                          +0.0332         +0.0332           372           385           372           385
BM_sinsp_split_container_image_stddev                          -0.4150         -0.4149             3             2             3             2
BM_sinsp_split_container_image_cv                              -0.4340         -0.4338             0             0             0             0

Copy link

codecov bot commented Nov 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.77%. Comparing base (facfcc3) to head (b9b7243).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2160   +/-   ##
=======================================
  Coverage   74.77%   74.77%           
=======================================
  Files         254      254           
  Lines       33505    33511    +6     
  Branches     5748     5748           
=======================================
+ Hits        25053    25058    +5     
- Misses       8452     8453    +1     
Flag Coverage Δ
libsinsp 74.77% <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 Nov 15, 2024

[APPROVALNOTIFIER] This PR is APPROVED

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

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:

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

@poiana
Copy link
Contributor

poiana commented Nov 15, 2024

LGTM label has been added.

Git tree hash: f7bbdc97c9cd5ce6fe6c6e822a3ddde031fa5f41

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.

3 participants