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

[BugFix] fix stack use after scope when get extra file size #39704

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

luohaha
Copy link
Contributor

@luohaha luohaha commented Jan 22, 2024

Why I'm doing:
When in ASAN mode, we find that BE crash because stack use after scope:

==2519==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7f655d1a9750 at pc 0x00000ac2e06b bp 0x7f655d1a95f0 sp 0x7f655d1a95e8
READ of size 8 at 0x7f655d1a9750 thread T4331
   #0 0xac2e06a in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::length() const /opt/rh/gcc-toolset-10/root/usr/include/c++/10.3.0/bits/basic_string.h:908
   #1 0xad8aab2 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::reserve(unsigned long) /opt/rh/gcc-toolset-10/root/usr/include/c++/10.3.0/bits/basic_string.tcc:284
   #2 0x1af62f3a in std::filesystem::__cxx11::path::operator=(std::filesystem::__cxx11::path const&) ../../../.././libstdc++-v3/src/c++17/fs_path.cc:457
   #3 0x1af53f8c in std::filesystem::__cxx11::_Dir::_Dir(std::filesystem::__cxx11::path const&, bool, std::error_code&) ../../../.././libstdc++-v3/src/c++17/fs_dir.cc:51
   #4 0x1af53f8c in std::filesystem::__cxx11::directory_iterator::directory_iterator(std::filesystem::__cxx11::path const&, std::filesystem::directory_options, std::error_code*) ../../../.././libstdc++-v3/src/c++17/fs_dir.cc:135
   #5 0xafaf18f in std::filesystem::__cxx11::directory_iterator::directory_iterator(std::filesystem::__cxx11::path const&) /opt/rh/gcc-toolset-10/root/usr/include/c++/10.3.0/bits/fs_dir.h:387
   #6 0x1323a519 in starrocks::TabletUpdates::_get_extra_file_size(long*, long*) const /root/celerdata/be/src/storage/tablet_updates.cpp:2888

What I'm doing:

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.2
    • 3.1
    • 3.0
    • 2.5

@luohaha luohaha requested a review from a team as a code owner January 22, 2024 13:22
Copy link

[FE Incremental Coverage Report]

pass : 0 / 0 (0%)

@wyb wyb merged commit ff7dfaa into StarRocks:main Jan 23, 2024
40 of 41 checks passed
Copy link

@Mergifyio backport branch-3.2

@github-actions github-actions bot removed the 3.2 label Jan 23, 2024
Copy link

@Mergifyio backport branch-3.1

@github-actions github-actions bot removed the 3.1 label Jan 23, 2024
Copy link
Contributor

mergify bot commented Jan 23, 2024

backport branch-3.2

✅ Backports have been created

Copy link
Contributor

mergify bot commented Jan 23, 2024

backport branch-3.1

✅ Backports have been created

Copy link

[BE Incremental Coverage Report]

fail : 1 / 4 (25.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 be/src/storage/tablet_updates.cpp 1 4 25.00% [2938, 2941, 2944]

Seaven pushed a commit to Seaven/starrocks that referenced this pull request Jan 30, 2024
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