-
Notifications
You must be signed in to change notification settings - Fork 964
Fix the coredump that occurs when calling KeyValueStorageRocksDB.count after rocksdb has been closed #4581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the coredump that occurs when calling KeyValueStorageRocksDB.count after rocksdb has been closed #4581
Conversation
…t() (possibly triggered by Prometheus) after RocksDB has been closed(apache#4243)
|
There's already #4243 to handle this issue. |
@zhaizhibo With this PR there could also be a race such as the count operation is in progress while the database gets closed. That would most likely result in a core dump as well. There's a need for a lock. |
lhotari
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to the closed flag, there's a need to have an exclusive lock on close and count methods so that the database doesn't get closed while the count method is executing. One possible solution is a StampedLock since a re-entrant lock isn't needed. The count method could acquire a read lock and close would acquire a write lock.
lhotari
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@zhaizhibo Please fix the checkstyle issues. |
|
@lhotari fixed. |
|
+1 |
…t after rocksdb has been closed (#4581) * Fix the coredump that occurs when calling KeyValueStorageRocksDB.count() (possibly triggered by Prometheus) after RocksDB has been closed(#4243) * fix race when count op in process and db gets closed. --------- Co-authored-by: zhaizhibo <[email protected]> (cherry picked from commit 2831ed3)
…t after rocksdb has been closed (#4581) * Fix the coredump that occurs when calling KeyValueStorageRocksDB.count() (possibly triggered by Prometheus) after RocksDB has been closed(#4243) * fix race when count op in process and db gets closed. --------- Co-authored-by: zhaizhibo <[email protected]> (cherry picked from commit 2831ed3)
…t after rocksdb has been closed (#4581) * Fix the coredump that occurs when calling KeyValueStorageRocksDB.count() (possibly triggered by Prometheus) after RocksDB has been closed(#4243) * fix race when count op in process and db gets closed. --------- Co-authored-by: zhaizhibo <[email protected]> (cherry picked from commit 2831ed3)
…t after rocksdb has been closed (apache#4581) * Fix the coredump that occurs when calling KeyValueStorageRocksDB.count() (possibly triggered by Prometheus) after RocksDB has been closed(apache#4243) * fix race when count op in process and db gets closed. --------- Co-authored-by: zhaizhibo <[email protected]> (cherry picked from commit 2831ed3) (cherry picked from commit 9d067f4)
…t after rocksdb has been closed (apache#4581) * Fix the coredump that occurs when calling KeyValueStorageRocksDB.count() (possibly triggered by Prometheus) after RocksDB has been closed(apache#4243) * fix race when count op in process and db gets closed. --------- Co-authored-by: zhaizhibo <[email protected]> (cherry picked from commit 2831ed3) (cherry picked from commit 9d067f4)
Descriptions of the changes in this PR:
Motivation
Fix #4238
Changes
Add a boolean status check before KeyValueStorageRocksDB.count()