You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At some unknown point in history, our use enable_shared_from_this has ended up causing every connection to get pinned in memory forever. Massive leak, unsure how this snuck by unnoticed for what appears to be some time.
The text was updated successfully, but these errors were encountered:
I believe the cause of this is the use of lambda's for the async asio functions, where we use a shared_ptr self reference and pass it to the lambda via the capture list. This smells like the kind of situation that would pin a shared_ptr forever because you're defining it inside of a member function and capturing inside of another member function.
Methinks the best solution here is to entirely eliminate shared_from_this and just have the acceptors keep instances to clients, and make them drop instances when a client flags itself as finito. This will avoid the problem both now and forever.
Sigh, even if we do the above change, the asio reactor will hold on to callback references for an indeterminate period of time. If we allow this to expire while the reactor is still holding those callbacks, then we'll get a hard crash because the object is gone when the callback is finally invoked.
At some unknown point in history, our use
enable_shared_from_this
has ended up causing every connection to get pinned in memory forever. Massive leak, unsure how this snuck by unnoticed for what appears to be some time.The text was updated successfully, but these errors were encountered: