Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a rare segfault happening when a pool is destroyed in the middle …
…of running conn cleanup Summary: Previously, I tried to fix a rare segfault that could happen when a pool is destroyed while connection cleanup routine traverses in a map and deleting MysqlPooledHolder pointer. This could happen because deleting MysqlPooledHolder pointer could decrease reference counter of pool to zero, leading to calling the pool destructor. Previous attempt to fix this was done by keeping MysqlPooledHolder pointer while the cleanup is in progress, but this was not enough because MysqlPooledHolder only has a weak_ptr to pool (AsynConnectionPool). In this diff, I try to keep shared_ptr<AsyncConnectionPool> so that the pool's destructor is never called while the cleanup is in progress. Also, I made the cleanup exit early if the pool is already destructed, which is identifiable when locking weak_ptr fails. Reviewed By: jkedgar Differential Revision: D35458447 fbshipit-source-id: 5bd06edd38304556375af0c89b1e8aa064e88802
- Loading branch information