Skip to content

branch-4.1: [Enhancement](BE) Make print stack API more stable #64093#65284

Open
zclllyybb wants to merge 1 commit into
apache:branch-4.1from
zclllyybb:codex/pick-stack-api-4.1
Open

branch-4.1: [Enhancement](BE) Make print stack API more stable #64093#65284
zclllyybb wants to merge 1 commit into
apache:branch-4.1from
zclllyybb:codex/pick-stack-api-4.1

Conversation

@zclllyybb

Copy link
Copy Markdown
Contributor

Proposed changes

Backport the stack trace API stability enhancement to branch-4.1.

This PR includes:

  • #64093 / dc70115: make the print stack API more stable

#64454 / 0141aa2 is already present on branch-4.1, so this PR does not duplicate it.

Validation

  • ./build.sh --be completed successfully in the branch-4.1 worktree
  • git diff --check upstream/branch-4.1..HEAD passed
  • Confirmed the ahead range does not contain #64454
  • Conflict-marker check passed

Issue Number: close apache#62497

follow up apache#64454

This PR adds a safer BE print stack API based on libunwind
signal-context unwinding.

Stack unwinding may call `dl_iterate_phdr()` to find DWARF/FDE metadata.
In signal-based stack capture, jemalloc profiling, or concurrent
`dlopen()` / `dlclose()`, re-entering glibc's loader-lock path may
deadlock or become unsafe.

Route GNU libunwind's PHDR lookup through Doris' lock-free PHDR cache.

The signal handler unwinds from the kernel-provided signal context,
while libunwind reads loaded-object metadata from Doris' PHDR snapshot
instead of calling glibc `dl_iterate_phdr()` directly.

Normal code paths still use the original live `dl_iterate_phdr()`
behavior.

The research project is at
https://github.com/JoverZhang/Doris-BE-Print-Stack-API-Research

Co-authored-by: zhaochangle <zhaochangle@selectdb.com>
(cherry picked from commit dc70115)
@zclllyybb zclllyybb requested a review from yiguolei as a code owner July 6, 2026 17:21
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@zclllyybb

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 54.78% (20954/38252)
Line Coverage 38.21% (199983/523348)
Region Coverage 34.67% (156968/452693)
Branch Coverage 35.63% (68541/192357)

@zclllyybb zclllyybb changed the title [branch-4.1][pick] Make print stack API more stable branch-4.1: [Enhancement](BE) Make print stack API more stable #64093 Jul 7, 2026
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

Successfully merging this pull request may close these issues.

3 participants