Crash on pthread lock error when deallocating in another thread
- Dominant language
- C++
- Stars
- 32.1k
- Forks
- 6.9k
- Avg merge
- 32m
- Merged PRs (30d)
- 1
Description
> Note: Please use Issues only for bug reports. For questions, discussions, feature requests, etc. post to dev group: https://groups.google.com/forum/#!forum/rocksdb or https://www.facebook.com/groups/rocksdb.dev
My objects are linked by a shared pointer. `rocksdb::DB` handle is stored in some of these objects. When the shared pointer is deallocated on program exit, I get this error:
```
pthread lock: Invalid argument
Aborted
```
which I tracked to `DBImpl::Close`.
If I manually deallocate the object by calling .reset() on my shared pointer, everything is fine.
### Expected behavior
Deallocation without crashes, of course.
### Actual behavior
Crash on mutex lock attempt called from `DBImpl::Close`.
### Steps to reproduce the behavior
1. Create an empty console program.
2. Create an object with a DB handle in it using `std::make_shared`.
3. Make sure the destructor deletes the DB handle or closes the database.
4. Open your DB (for read only or write).
5. On exit, let the console program handle the shared pointer naturally. It will crash.
Contributor guide
Assessment
This issue has not been assessed yet.