[MDEV-6162] TokuDB: multiple locks and unlock of not locked TOKUDB_SHARE::num_DBs_lock Created: 2014-04-24 Updated: 2014-05-06 Resolved: 2014-05-06 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 5.5.37 |
| Fix Version/s: | 5.5.38 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sergey Vojtovich | Assignee: | Unassigned |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | tokudb, upstream | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
Found while analyzing test failures for To reproduce these problems compile MariaDB as described in First, there are attempts to lock read-locked num_DBs_lock. It is locked in ha_tokudb::start_bulk_insert() and then in ha_tokudb::update_row() or ha_tokudb::acquire_table_lock(). It may be not a problem, but as this situation is handled in ha_tokudb::write_row() it should be checked at least. Second, ha_tokudb::write_row() unlocks not locked num_DBs_lock (in case of error in the very beginning of the function). This should be a problem according to the pthread_rwlock_unlock manual: results are undefined if the read-write lock rwlock is not held by the calling thread. A rough patching solving the above issues attached. |
| Comments |
| Comment by Rich Prohaska [ 2014-04-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Can I define a cmake variable or do I need to hack the source to define USE_MUTEX_INSTEAD_OF_RW_LOCKS? | ||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2014-04-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Rich, there seem to be no corresponding cmake variable. Either hack sources (include/my_pthread.h) or compile with CFLAGS=-DUSE_MUTEX_INSTEAD_OF_RW_LOCKS. | ||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rich Prohaska [ 2014-04-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||
|
I want to reproduce case (1). If you know of a particular tokudb test that exposes these locking problems, please let me know. Otherwise, I will run all of the test and try to discover one. The error cleanup in described in case (2) is unfortunate. Will fix that one. | ||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2014-04-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||
|
IIRC any of the following tests should expose the problem: | ||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rich Prohaska [ 2014-04-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||
|
I hit this problem first. Is there is patch for it? #2 0x0000000000cb87d4 in safe_mutex_lock (mp=0x15605e0 <LOCK_system_variables_hash>, my_flags=0, file=0xd61ec0 "/home/prohaska/mdev6162/mariadb-5.5.37/include/mysql/psi/mysql_thread.h", line=761) at /ho\ | ||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2014-04-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Yes, see first comment in A workaround:
| ||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rich Prohaska [ 2014-04-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||
|
tokudb 7.1.6 will include these bug fixes. Thanks. |