Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make HttpAppFrameworkImpl::quit() safe #2247

Merged
merged 1 commit into from
Feb 2, 2025

Conversation

Demilivor
Copy link
Contributor

@Demilivor Demilivor commented Jan 30, 2025

Description:

It is possible to call HttpAppFrameworkImpl::quit() 2 times in a row directly or in the default signal handler.

Calling such code:

       app().quit();
       app().quit();

Execues double calling of such code in internal lambda:

    listenerManagerPtr_->stopListening();
    listenerManagerPtr_.reset();

And it leads to undefined behavior.

Fix:

Atomically check and set running_ flag earlier before queuing the lambda that resets pointers.

@an-tao an-tao merged commit f5de41f into drogonframework:master Feb 2, 2025
34 of 35 checks passed
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