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

   ### Background
   
   CDC client unit tests temporarily change DORIS_HOME, LOG_DIR and JAVA_HOME 
while exercising startup errors and process ownership. The fixture restores the 
original environment during cleanup and several tests also restore it before 
retrying startup.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: None
   PR Type: Test
   
   Problem Summary:
   
   The CDC fixture kept raw getenv() pointers across environment mutations. On 
macOS, StartCdcClientMissingJavaHome frees the JAVA_HOME string with 
unsetenv(), and TearDown() then reads the freed value through setenv(), 
aborting ASAN validation. Copy the three original values into optional strings 
and use those snapshots at every restore point, preserving the distinction 
between unset and empty values.
   
   ### Details
   
   - **Failure:** The ASAN integration run stopped at 
StartCdcClientMissingJavaHome after six successful cases. The read is in 
TearDown() and the free is in the test's unsetenv().
   - **Cause:** getenv() returns borrowed storage that environment mutation may 
invalidate. Saving a pointer does not preserve the original value. The same 
ownership issue applies to all three saved environment variables and 
intermediate restore sites.
   - **Stability evidence:** After the fix, all 51 selected native ASAN 
integration cases pass, including all 36 CDC cases and the original 
missing-Java case. The original CI stale-generation case also passes 100 fixed 
repetitions. Its SIGTERM assertion and 200 ms grace period are unchanged; this 
does not establish the cause of the separate Linux CI SIGTERM receipt failure.
   
   ### Testing
   
   - Before extracting this fix onto `master`, macOS arm64, Clang 22.1.8, 
ASAN_UT with line tables: `run-be-ut.sh` selected `CdcClientMgrTest.*` and the 
ORC integration cases; 51/51 passed with no skips, including all 36 CDC tests.
   - On the same pre-extraction build, `GTEST_REPEAT=100 
GTEST_BREAK_ON_FAILURE=1 ./run-be-ut.sh --run 
--filter='CdcClientMgrTest.StaleGenerationCannotTerminateAReusedNumericPid' -j 
8`: 100/100 passed.
   - The original fixture fails before this change with an ASAN 
heap-use-after-free. Production CDC logic, assertions and timeouts are 
unchanged.
   
   ### Notes for Reviewers
   
   Only the CDC fixture fix is extracted here. Its source is byte-identical to 
the tested candidate; the fixture baseline and production CDC source also match 
current `master`. The complete binary has not been rebuilt after extraction 
onto `master`. The separate ORC fix is in apache/doris-thirdparty#437.
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Behavior changed: No
   - Does this need documentation: No
   - Pre-submission status: Partially verified: local ASAN results predate 
extraction onto master; the full Linux Doris BE unit suite has not run locally
   
   ### AI Disclosure
   
   - Tool: Codex (GPT-6)
   - Generated: Fixture fix, investigation and this description
   - Human review: not stated
   


-- 
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