-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 use of rtxn without a mdb_txn_safe wrapper #8379
Conversation
this is not an ideal fix, just a quick'n'dirty to make sure we're on the right track. the problem with this patch is that it means TXN_PREFIX_RDONLY uses mdb_txn_safe redundantly. |
211a0e7
to
897ce7d
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.
This seems to cause a deadlock / infinite loop in core tests on CI, but I didn't run core tests locally yet to confirm it.
ok. I see that it's looping, will check it out. |
src/blockchain_db/blockchain_db.h
Outdated
if (readonly) | ||
db->block_rtxn_stop(); | ||
else | ||
if (!readonly) |
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.
Should this be if (!readonly && active)
?
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.
This is the only relevant comment, and this code is shippable otherwise.
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.
It is already only invoked if (active), see line 1886.
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.
I guess, to eliminate all doubt, could move the if (active) check here from there.
#define TXN_PREFIX_RDONLY() \ | ||
MDB_txn *m_txn; \ | ||
mdb_txn_cursors *m_cursors; \ | ||
mdb_txn_safe auto_txn; \ |
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.
Is this still needed if block_rtxn_start
uses it too now? This should be why the code worked in most situations - the bulk of the calls were using TXN_PREFIX_RDONLY
.
I don't think it hurts to double up, but it looks unnecessary.
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.
Oooops, looks like you commented on this above already. I figured it would work, but I think you'd have to go back through and do a major re-haul to "get it correct", whereas this needs push sooner rather than later.
Fix use of rtxn without a mdb_txn_safe wrapper