Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.

stat 167 gh 704 read buffer safety#831

Merged
heifner merged 2 commits intomasterfrom
feature/stat-167-gh-704-read-buffer-safety
Nov 30, 2017
Merged

stat 167 gh 704 read buffer safety#831
heifner merged 2 commits intomasterfrom
feature/stat-167-gh-704-read-buffer-safety

Conversation

@wanderingbort
Copy link
Contributor

related to #704 and stat 167

There were two callstacks representing deep boost socket code writing to freed memory. This was because our connection object owned the data that backed the mutable_buffer s we passed into async_read_some if 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 the connection will 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 connection object

… the lifecycle of the message_buffer object which is weakly owned by the boost::mutable_buffer s we passed to async_read_some
@pmesnier pmesnier self-requested a review November 30, 2017 19:00
@heifner heifner merged commit de42c5c into master 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)
@heifner heifner deleted the feature/stat-167-gh-704-read-buffer-safety branch January 26, 2018 22:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants