Skip to content

Segmentation fault when sample small allocation #275

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

Closed
lhsoft opened this issue Feb 24, 2025 · 3 comments
Closed

Segmentation fault when sample small allocation #275

lhsoft opened this issue Feb 24, 2025 · 3 comments

Comments

@lhsoft
Copy link

lhsoft commented Feb 24, 2025

`
#0 0x0000000000bf2ed5 in UnwindImpl<false, false> (result=0x7f04b7baf9a0, sizes=, max_depth=64, skip_count=0, ucp=, min_dropped_frames=0x0) at external/_maindata_deps_extcom_google_absl/absl/debugging/internal/stacktrace_x86-inl.inc:339

#1 0x0000000000bf2fa6 in absl::(anonymous namespace)::Unwind<false, false> (min_dropped_frames=0x0, uc=0x0, skip_count=skip_count@entry=0, max_depth=max_depth@entry=64, sizes=0x0, result=result@entry=0x7f04b7baf350) at external/_maindata_deps_extcom_google_absl/absl/debugging/stacktrace.cc:103

#2 absl::GetStackTrace (result=result@entry=0x7f04b7baf9a0, max_depth=max_depth@entry=64, skip_count=skip_count@entry=0) at external/_maindata_deps_extcom_google_absl/absl/debugging/stacktrace.cc:103

#3 0x0000000000bb4059 in tcmalloc::tcmalloc_internal::SampleifyAllocation(tcmalloc::tcmalloc_internal::Static&, unsigned long, unsigned long, unsigned long, unsigned long, __hot_cold_t, bool, void*, tcmalloc::tcmalloc_internal::Span*) ()
at external/_maindata_deps_extcom_github_google_tcmalloc/tcmalloc/allocation_sampling.cc:143

#4 0x0000000000babf1e in tcmalloc::tcmalloc_internal::SampleSmallAllocation<tcmalloc::tcmalloc_internal::TCMallocPolicy<tcmalloc::tcmalloc_internal::CppOomPolicy, tcmalloc::tcmalloc_internal::DefaultAlignPolicy> > (size_class=69, weight=2133448, requested_size=65537, state=..., policy=..., res=...)
at external/_maindata_deps_extcom_github_google_tcmalloc/tcmalloc/internal/optimization.h:60

#5 tcmalloc::tcmalloc_internal::alloc_small_sampled_hooks_or_perthread<tcmalloc::tcmalloc_internal::TCMallocPolicy<tcmalloc::tcmalloc_internal::CppOomPolicy, tcmalloc::tcmalloc_internal::DefaultAlignPolicy> > (size=65537, size_class=69, weight=2133448, policy=...)
at external/_maindata_deps_extcom_github_google_tcmalloc/tcmalloc/tcmalloc.cc:933

#6 0x00000000013a5dfc in std::__cxx11::basic_string<char, std::char_traits, std::allocator >::reserve(unsigned long) () at external/_maindata_deps_extcom_github_google_tcmalloc/tcmalloc/page_allocator.h:290
`
we are using the commit https://github.com/google/tcmalloc/commit/36402deb8caab799b856785994bf8969ecfd833d

@ckennelly
Copy link
Collaborator

More information would be necessary to debug the failure here.

The code paths in question are well-worn. Rather than this being due to an inherent bug, is this from a stack overflow?

@lhsoft
Copy link
Author

lhsoft commented Feb 26, 2025

@ckennelly
The root cause is that the caller function wasn't compiled with "-fno-omit-frame-pointer", so the caller func used the RBP register for other purpose which cause the GetStatckTrace func crashed

@ckennelly
Copy link
Collaborator

Since this is an issue with the Abseil stack tracing implementation, I'm going to close out this issue since it isn't a bug in TCMalloc.

It may be worth filing a detailed report with Abseil instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants