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

   ### What problem does this PR solve?
   
   Issue Number: None
   
   Related PR: None
   
   Problem Summary:
   
   When a BE service fails to start with `enable_graceful_exit_check=true`, the 
startup failure path calls `exit(1)` while StorageEngine background workers are 
still running. `exit(1)` begins process-wide static destruction before 
`ExecEnv` and `StorageEngine` are torn down.
   
   A path GC worker can therefore keep matching tablet paths while the 
function-local static RE2 object in 
`TabletManager::get_tablet_id_and_schema_hash_from_path()` is being destroyed. 
This was observed after the backend Thrift port failed to bind: the path GC 
thread crashed at address `0x0` in `re2::Prog::SearchOnePass`, and the main 
thread subsequently waited indefinitely for that worker.
   
   This change:
   
   - stops and joins every created server starter on the graceful 
startup-failure path;
   - releases the backend service before destroying its dependencies;
   - explicitly destroys `ExecEnv`, which stops and joins StorageEngine 
workers, before calling `exit(1)`;
   - preserves the existing immediate `_exit(1)` behavior when graceful exit 
checking is disabled.
   
   Failed starters are joined to release partially initialized resources, while 
`stop()` is called only for starters that completed startup successfully.
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Test:
     - [x] Manual test
       - Targeted clang-format 16 check passed for 
`be/src/service/doris_main.cpp`.
       - A local BE build could not start because the macOS environment does 
not have Homebrew; `run buildall` is requested below for full build validation.
   - Behavior changed:
     - [ ] Yes
     - [x] No. Only abnormal BE startup cleanup ordering changes.
   - Does this need documentation?
     - [x] No
     - [ ] Yes


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