Skip to content

branch-4.0: [fix](http) Fix EvHttpServer crash during graceful shutdown in ASAN mode #59769#65279

Open
github-actions[bot] wants to merge 1 commit into
branch-4.0from
auto-pick-59769-branch-4.0
Open

branch-4.0: [fix](http) Fix EvHttpServer crash during graceful shutdown in ASAN mode #59769#65279
github-actions[bot] wants to merge 1 commit into
branch-4.0from
auto-pick-59769-branch-4.0

Conversation

@github-actions

@github-actions github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Cherry-picked from #59769

…ode (#59769)

The crash occurred because evhttp was created as a local shared_ptr in
the lambda function, and its destruction happened after
event_base_dispatch returned. This caused use-after-free issues when
ASAN/UBSAN tried to verify the object dynamic type during shared_ptr
destruction.

Fix by:
1. Moving evhttp objects to class member _evhttp_servers for explicit
lifecycle management
2. Reordering resource cleanup in stop():
   - Close server_fd first to reject new connections
   - Break event loops to make dispatch return
   - Wait for worker threads to finish
   - Clear evhttp before event_base (correct dependency order)
@github-actions github-actions Bot requested a review from morningman as a code owner July 6, 2026 14:42
@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?

@hello-stephen

Copy link
Copy Markdown
Contributor

run buildall

1 similar comment
@liaoxin01

Copy link
Copy Markdown
Contributor

run buildall

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.

2 participants