mrhhsg opened a new pull request, #70633:
URL: https://github.com/apache/doris/pull/70633

   ### Background
   
   The Linux BE thread-stack HTTP action unwinds a target thread from its 
signal context. It uses a PHDR snapshot so unwinding does not re-enter the live 
loader list while a target thread is interrupted.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: None
   PR Type: Bugfix
   
   Problem Summary: On Linux AArch64, the action reports stack capture as 
unsupported even when GNU libunwind is enabled because its capture path is 
guarded for x86_64 only. Enabling that path also requires a libunwind build 
that avoids allocator-backed compressed `.debug_frame` decoding, a correctly 
initialized mini-debug allocator, and safe rejection when the PHDR cache is 
unavailable. This PR enables AArch64 signal-context capture and makes the 
required dependency and request checks explicit.
   
   ### Details
   
   - **Change map:** 142 changed lines in BE/runtime and third-party build 
code; 185 changed lines in BE and third-party tests. No generated files or 
documentation changes.
   - **Frequency:** Every valid AArch64 stack-capture request previously took 
the unsupported path. The allocator-reentry risk requires a capture during 
allocator activity with compressed `.debug_frame`; an older complete 
third-party installation can retain that decoder. A TSan build lacks the PHDR 
cache and could terminate the BE on its first stack request.
   - **Root cause:** Five x86_64-only guards exclude AArch64 from the libunwind 
and PHDR preparation path. GNU libunwind's AArch64 configuration enables an 
allocator-backed `.debug_frame` decoder by default; the mini-debug allocator 
state was not initialized. A source-only build check does not cover an already 
installed archive, and the old patch marker does not identify the patch 
generation.
   - **Why existing tests missed it:** The action tests primarily exercised 
x86_64 and did not require nonzero frames for each target thread. They did not 
cover the TSan cache-unavailable route, a stale complete installed archive, 
patch-generation migration, or stripped mini-debug symbol lookup.
   - **Fix:** Apply the existing signal-context unwind path whenever 
`USE_UNWIND` is enabled on Linux. Reject cache-unavailable TSan requests before 
signaling a target thread. Zero-initialize the mini-debug allocator, disable 
`.debug_frame` decoding in the libunwind build, and refresh cached sources when 
the patch changes. Publish a versioned contract only after a checked libunwind 
installation, binding the current patch and installed archive hashes; verify 
that contract at AArch64 BE configure time before importing the archive.
   - **Other paths and branches:** x86_64 capture and disabled-unwind/non-Linux 
routing remain unchanged. `.eh_frame` unwinding and `.gnu_debugdata` lookup 
remain available, but `.debug_frame`-only fallback is no longer available, 
including outside stack capture. Existing AArch64 dependency installations 
without the matching contract must be rebuilt. No wire or storage format 
changes.
   
   ### Testing
   
   - Local x86_64 ASAN `BUILD_TYPE=ASAN ./build.sh --be --fe -j 8`: passed; FE 
checkstyle reported no violations.
   - Local ASAN `BUILD_TYPE_UT=ASAN ./run-be-ut.sh --run 
--filter='BeThreadStackActionTest.*:PhdrCacheTest.*:PhdrCacheDeathTest.*' -j 
8`: 11/11 passed.
   - Local isolated HTTP regression 
`http_rest_api/get/test_be_stack_trace_api`: 1/1 suite passed; the cluster was 
stopped afterward.
   - `bash thirdparty/test/libunwind-signal-contract-test.sh`: AArch64 
configure acceptance and stale/missing/modified archive or patch rejection 
cases passed; x86_64 and unwind-off routes were not rejected.
   - An isolated patched-libunwind build and installed-only mini-debug symbol 
lookup smoke test passed. TSan-macro test translation-unit syntax, BE 
formatting, build hygiene, changed-line clang-tidy, shell syntax, and diff 
whitespace checks passed.
   - Native AArch64 build/runtime, real TSan runtime, final AArch64 
package/linkage, and full CI were not run locally.
   
   ### Release note
   
   Linux AArch64 builds can capture remote-thread stacks through the BE 
stack-trace API. Older libunwind installations without a matching signal-unwind 
contract must be rebuilt; `.debug_frame`-only unwind information may yield 
fewer frames. TSan builds reject unsupported capture requests without 
terminating the BE.
   
   ### Check List (For Author)
   
   - Behavior changed: Yes (see Details)
   - Does this need documentation: No
   - Pre-submission status: Partially verified: native AArch64 and TSan 
runtime, final package/linkage, and full CI were not run locally.
   
   ### AI Disclosure
   
   - Tool: OpenAI Codex
   - Generated: Code, tests, and this description.
   - Human review: Pending.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to