sollhui opened a new pull request, #67722: URL: https://github.com/apache/doris/pull/67722
### What problem does this PR solve? Backport #67580 to branch-4.1. A bthread could create its ThreadContext before its key was initialized. Later key creation changed the key version, causing context lookup to return null and scoped memory-tracker cleanup to crash. Initialize the key once before first use and retain it for the process lifetime. The conflict in thread_context.cpp was resolved by retaining the branch-4.1 function layout. The added and removed lines match the original PR. ### Release note Fix a potential BE crash during scoped memory-tracker cleanup caused by bthread context key initialization. ### Check List (For Author) - Test: Compilation and tests skipped as requested. clang-format 16 and git diff --check passed. - Behavior changed: Yes; initialize the bthread context key before first use and preserve its process lifetime. - Does this need documentation: No. -- 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]
