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

Fix heap-use-after-free error when shutting down envoy. #758

Merged
merged 3 commits into from
Apr 13, 2017
Merged

Fix heap-use-after-free error when shutting down envoy. #758

merged 3 commits into from
Apr 13, 2017

Conversation

fengli79
Copy link
Contributor

The HotRestartImpl holds a socket event of the domain socket for admin purpose. It needs to be deleted before the envoy server gets deleted, as the envoy server owns the event_base which already been deleted in the destructor by the event_base_free().
Also, the envoy server needs the HotRestartImpl to record stats, so the HotRestartImpl cannot be deleted before clean up the stats recorders in the envoy server.

The HotRestart holds a socket event for the domain socket used for admin
purpose, it need to be deleted before the envoy server gets deleted, as
the envoy server own the event_base and which already deleted the
registered events with the event_base_free().
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, small naming nit.

@@ -65,6 +65,11 @@ class HotRestart {
virtual void terminateParent() PURE;

/**
* Shutdown admin processing in the current process.
*/
virtual void shutdownAdmin() PURE;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This doesn't really have anything to do with admin. Can we just call this shutdown() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

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