This repository was archived by the owner on Aug 2, 2022. It is now read-only.
Merged
Conversation
… the lifecycle of the message_buffer object which is weakly owned by the boost::mutable_buffer s we passed to async_read_some
pmesnier
approved these changes
Nov 30, 2017
spoonincode
pushed a commit
that referenced
this pull request
Dec 8, 2017
…r-safety stat 167 gh 704 read buffer safety (reapplied on noon branch)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
related to #704 and stat 167
There were two callstacks representing deep boost socket code writing to freed memory. This was because our
connectionobject owned the data that backed themutable_buffers we passed intoasync_read_someif that object died and the asio processing still tried to write to the buffer for any reason boom.The "safe" fix was to capture a
shared_ptr<connection>in the handler so that theconnectionwill survive the lifetime of the call. This exposed several other lifetime issues on shutdown and as a result changes had to be made to appbase ( see EOSIO/appbase#7 )In addition, some of the plugin level tracking information was not getting cleared up in certain error cases and when requesting a disconnect of a peer we are now explicitly closing the socket as an outstanding read lambda may now delay the destruction of the
connectionobject