-
Notifications
You must be signed in to change notification settings - Fork 839
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
Prevent rocksdb segfaults when accessing closed storage #5527
Prevent rocksdb segfaults when accessing closed storage #5527
Conversation
|
5856e30
to
70bdee0
Compare
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, couple of nits
@@ -114,4 +114,11 @@ public interface KeyValueStorage extends Closeable { | |||
* @throws StorageException problem encountered when starting a new transaction. | |||
*/ | |||
KeyValueStorageTransaction startTransaction() throws StorageException; | |||
|
|||
/** | |||
* Return Whether the underlying storage is closed or not. |
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.
* Return Whether the underlying storage is closed or not. | |
* Return Whether the underlying storage is closed. |
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.
👌
private void throwIfClosed() { | ||
if (parent.isClosed()) { | ||
LOG.error("Attempting to use a closed RocksDBKeyValueStorage"); | ||
throw new IllegalStateException("Storage has been closed"); |
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.
RocksDBSnapshotTransaction uses StorageException - does it make sense to match that here?
throw new StorageException("Storage has already been closed");
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.
Yes, I think storage exception is better everywhere possible 👍
...es/kvstore/src/main/java/org/hyperledger/besu/services/kvstore/SegmentedKeyValueStorage.java
Outdated
Show resolved
Hide resolved
...es/kvstore/src/main/java/org/hyperledger/besu/services/kvstore/SegmentedKeyValueStorage.java
Outdated
Show resolved
Hide resolved
...ore/src/main/java/org/hyperledger/besu/services/kvstore/SegmentedKeyValueStorageAdapter.java
Outdated
Show resolved
Hide resolved
…hutdown Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
… in debug Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
70bdee0
to
8a16110
Compare
Signed-off-by: garyschulte <garyschulte@gmail.com>
8a16110
to
96140be
Compare
…5527) * add isClosed check to Transaction decorator to prevent segfaults on shutdown Signed-off-by: garyschulte <garyschulte@gmail.com>
…5527) * add isClosed check to Transaction decorator to prevent segfaults on shutdown Signed-off-by: garyschulte <garyschulte@gmail.com>
PR description
gate transaction access on whether the underlying storage has closed. This prevents segfaults at shutdown when we close rocksdb, but there are async processes attempting to access the db.
Currently evaluating to ensure there is no noticeable performance regression.
Fixed Issue(s)
#5362