-
Notifications
You must be signed in to change notification settings - Fork 470
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MyRocks crashes on pure virtual function when querying rocksdb_trx list
Summary: Rdb_transactions are added and removed from the global list by the Rdb_transaction constructor/destructors. However, information_schema.rocksdb_trx queries scan this global list and calls the virtual function is_writebatch_trx() to determine how to cast the object. It is possible for the subclasses destructors to have completed, but before Rdb_transaction's destructor can remove the object from the global list that an information_schema.rocksdb_trx query is initiated. The query walks the list of transactions and comes across a partially deconstructed Rdb_transaction_impl object. When it calls is_writebatch_trx() on this object, it triggers a pure function access crash because the function has already been removed/cleared. Fix this by adding the objects to the global list after the object is fully constructed and remove it from the global list when the object enters the destructor. Reviewed By: yizhang82 Differential Revision: D29164519 fbshipit-source-id: aaf39f330c8
- Loading branch information
1 parent
09220b3
commit 8dfbf79
Showing
3 changed files
with
88 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
create table t1 (a int) engine=rocksdb; | ||
set @@global.debug = '+d,rocksdb_trx_list_crash'; | ||
insert into t1 values (1); | ||
insert into t1 values (2); | ||
set debug_sync = 'now WAIT_FOR destructor_started'; | ||
select count(*) from information_schema.rocksdb_trx; | ||
count(*) | ||
0 | ||
set debug_sync = 'now SIGNAL trx_list_query'; | ||
set @@global.debug = '-d,rocksdb_trx_list_crash'; | ||
SELECT a from t1; | ||
a | ||
1 | ||
2 | ||
DROP TABLE t1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--source include/have_rocksdb.inc | ||
--source include/have_debug_sync.inc | ||
|
||
--source include/count_sessions.inc | ||
|
||
create table t1 (a int) engine=rocksdb; | ||
|
||
set @@global.debug = '+d,rocksdb_trx_list_crash'; | ||
|
||
connect (con1,localhost,root,,); | ||
insert into t1 values (1); | ||
insert into t1 values (2); | ||
# Disconnect will trigger transaction cleanup | ||
disconnect con1; | ||
|
||
connection default; | ||
|
||
# Wait for the connection to be waiting for cleanup | ||
set debug_sync = 'now WAIT_FOR destructor_started'; | ||
|
||
# This will be empty, but the query will still walk the list | ||
select count(*) from information_schema.rocksdb_trx; | ||
|
||
# Allow the connection to finish cleanup | ||
set debug_sync = 'now SIGNAL trx_list_query'; | ||
|
||
set @@global.debug = '-d,rocksdb_trx_list_crash'; | ||
|
||
SELECT a from t1; | ||
DROP TABLE t1; | ||
|
||
--source include/wait_until_count_sessions.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters