Skip to content

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

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

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

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 yiguolei as a code owner July 6, 2026 14:42
@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.

1 participant