Vlad Lesin
b54e7b0cea
MDEV-31185 rw_trx_hash_t::find() unpins pins too early
...
rw_trx_hash_t::find() acquires element->mutex, then unpins pins, used for
lf_hash element search. After that the "element" can be deallocated and
reused by some other thread.
If we take a look rw_trx_hash_t::insert()->lf_hash_insert()->lf_alloc_new()
calls, we will not find any element->mutex acquisition, as it was not
initialized yet before it's allocation. rw_trx_hash_t::insert() can reuse
the chunk, unpinned in rw_trx_hash_t::find().
The scenario is the following:
1. Thread 1 have just executed lf_hash_search() in
rw_trx_hash_t::find(), but have not acquired element->mutex yet.
2. Thread 2 have removed the element from hash table with
rw_trx_hash_t::erase() call.
3. Thread 1 acquired element->mutex and unpinned pin 2 pin with
lf_hash_search_unpin(pins) call.
4. Some thread purged memory of the element.
5. Thread 3 reused the memory for the element, filled element->id,
element->trx.
6. Thread 1 crashes with failed "DBUG_ASSERT(trx_id == trx->id)"
assertion.
Note that trx_t objects are also reused, see the code around trx_pools
for details.
The fix is to invoke "lf_hash_search_unpin(pins);" after element->trx is
stored in local variable in rw_trx_hash_t::find().
Reviewed by: Nikita Malyavin, Marko Mäkelä.
2023-05-19 15:50:20 +03:00
..
2020-05-05 20:33:10 +03:00
2020-05-04 09:35:38 +05:30
2020-05-04 09:35:38 +05:30
2020-05-04 09:35:38 +05:30
2020-05-04 09:35:38 +05:30
2022-09-13 16:36:38 +03:00
2022-09-13 16:36:38 +03:00
2022-09-13 16:36:38 +03:00
2022-09-12 22:10:39 +04:00
2022-09-12 22:10:39 +04:00
2021-01-19 16:18:37 +05:30
2020-03-20 22:06:55 +02:00
2021-11-12 17:46:35 +05:30
2022-09-12 22:10:39 +04:00
2022-04-21 15:23:21 +03:00
2021-11-12 17:46:35 +05:30
2022-09-12 22:10:39 +04:00
2022-09-13 16:36:38 +03:00
2022-10-22 14:22:20 +04:00
2022-09-13 16:36:38 +03:00
2022-09-13 16:36:38 +03:00
2020-05-15 15:10:58 +03:00
2022-09-12 22:10:39 +04:00
2022-09-13 16:36:38 +03:00
2022-09-13 16:36:38 +03:00
2022-02-11 12:26:27 +03:00
2022-09-12 22:10:39 +04:00
2020-01-15 18:06:24 +01:00
2020-03-20 22:06:55 +02:00
2022-07-04 08:04:44 +03:00
2022-08-17 11:08:49 +05:30
2022-08-17 11:08:49 +05:30
2022-08-17 11:08:49 +05:30
2022-08-17 11:08:49 +05:30
2022-08-17 11:08:49 +05:30
2020-03-23 16:41:48 +05:30
2019-09-01 19:17:35 +03:00
2019-07-22 15:28:05 +03:00
2022-12-20 11:31:49 +03:00
2021-11-12 17:46:35 +05:30
2022-11-09 21:00:24 +03:00
2020-08-04 11:49:52 +03:00
2020-08-04 11:49:52 +03:00
2023-04-19 17:11:14 +05:30
2022-11-11 10:21:28 +11:00
2021-10-21 13:41:04 +03:00
2021-10-21 13:41:04 +03:00
2022-09-12 22:10:39 +04:00
2022-09-13 16:36:38 +03:00
2022-08-30 12:02:56 +03:00
2022-09-13 16:36:38 +03:00
2022-09-13 16:36:38 +03:00
2023-02-16 16:04:46 +05:30
2022-04-27 13:38:08 +03:00
2019-11-19 01:32:50 +02:00
2021-08-17 16:09:55 +03:00
2021-07-27 20:30:33 +03:00
2021-08-17 20:28:42 +06:00
2022-12-09 10:42:19 +02:00
2022-09-12 22:10:39 +04:00
2022-12-15 11:14:23 +02:00
2023-03-29 16:49:10 +03:00
2021-04-14 10:33:59 +03:00
2020-03-20 22:06:55 +02:00
2020-03-20 22:06:55 +02:00
2022-01-19 11:10:45 +11:00
2022-09-12 22:10:39 +04:00
2022-09-12 22:10:39 +04:00
2022-09-12 22:10:39 +04:00
2022-09-12 22:10:39 +04:00
2020-01-15 18:06:24 +01:00
2019-08-13 17:19:00 +03:00
2021-02-15 18:12:31 +02:00
2019-07-30 21:57:48 +04:00
2022-09-13 16:36:38 +03:00
2019-08-21 15:23:45 +03:00
2020-01-15 18:06:24 +01:00
2022-09-12 22:10:39 +04:00
2020-01-24 14:50:23 +01:00
2019-08-13 13:32:27 +03:00
2022-09-12 22:10:39 +04:00
2020-01-15 18:06:24 +01:00
2022-09-12 22:10:39 +04:00
2022-09-12 22:10:39 +04:00
2022-09-12 22:10:39 +04:00
2022-11-22 14:03:23 +04:00
2023-04-04 12:30:50 +04:00
2020-03-17 16:28:16 +02:00
2021-09-29 16:03:02 +03:00
2022-09-12 22:10:39 +04:00
2020-07-31 18:09:08 +03:00
2022-02-25 13:00:48 +02:00
2022-09-13 16:36:38 +03:00
2022-01-29 15:41:05 +01:00
2019-12-09 15:09:41 +01:00
2019-12-09 15:09:41 +01:00
2020-12-19 11:44:42 +01:00
2022-09-13 16:36:38 +03:00
2022-05-18 01:25:30 +02:00
2022-09-13 16:36:38 +03:00
2019-11-01 15:23:18 +02:00
2020-12-11 17:33:44 +03:00
2020-01-15 18:06:24 +01:00
2023-03-29 16:49:10 +03:00
2020-01-17 14:27:28 +02:00
2020-04-08 09:59:00 +03:00
2022-09-12 22:10:39 +04:00
2022-09-13 16:36:38 +03:00
2022-09-13 16:36:38 +03:00
2019-12-09 15:09:41 +01:00
2022-10-11 15:18:49 +03:00
2022-09-12 22:10:39 +04:00
2022-09-12 22:10:39 +04:00
2019-10-30 16:47:43 +01:00
2022-09-13 16:36:38 +03:00
2022-09-13 16:36:38 +03:00
2022-09-12 22:10:39 +04:00
2022-09-13 16:36:38 +03:00
2022-09-12 22:10:39 +04:00
2022-09-13 16:36:38 +03:00
2022-09-12 22:10:39 +04:00
2022-09-13 16:36:38 +03:00
2020-02-11 14:40:35 +01:00
2019-09-26 16:56:02 +03:00
2022-09-12 22:10:39 +04:00
2022-09-12 22:10:39 +04:00
2022-09-12 22:10:39 +04:00
2019-08-21 15:23:45 +03:00
2022-09-13 16:36:38 +03:00
2022-09-12 22:10:39 +04:00
2022-09-13 16:36:38 +03:00
2022-09-12 22:10:39 +04:00
2022-09-13 16:36:38 +03:00
2022-09-13 16:36:38 +03:00
2022-09-13 16:36:38 +03:00
2022-09-13 16:36:38 +03:00
2022-09-12 22:10:39 +04:00
2019-12-09 15:09:41 +01:00
2022-09-12 22:10:39 +04:00
2022-09-13 16:36:38 +03:00
2022-09-13 16:36:38 +03:00
2022-09-13 16:36:38 +03:00
2022-09-13 16:36:38 +03:00
2022-09-13 16:36:38 +03:00
2022-09-13 16:36:38 +03:00
2019-08-29 08:23:19 +03:00
2020-01-15 18:06:24 +01:00
2020-01-15 18:06:24 +01:00
2022-09-20 12:38:25 +03:00
2022-12-13 11:37:33 +02:00
2022-09-12 22:10:39 +04:00
2022-09-12 22:10:39 +04:00
2019-09-10 16:14:50 +03:00
2022-09-12 22:10:39 +04:00
2022-12-13 11:37:33 +02:00
2022-12-13 11:37:33 +02:00
2023-04-03 14:36:11 +02:00
2022-09-12 22:10:39 +04:00
2019-07-18 17:01:59 +03:00
2022-09-13 16:36:38 +03:00
2022-12-20 11:31:49 +03:00
2022-09-13 16:36:38 +03:00
2022-07-04 08:04:44 +03:00
2022-09-13 16:36:38 +03:00
2023-03-14 13:34:23 +05:30
2021-07-20 09:29:45 +03:00
2022-03-01 13:01:48 +05:30
2020-07-20 14:15:56 +03:00
2020-07-20 14:15:56 +03:00
2022-06-30 17:30:13 +05:30
2022-09-13 16:36:38 +03:00
2022-09-12 22:10:39 +04:00
2020-05-26 20:27:13 +05:30
2020-05-26 20:27:13 +05:30
2020-05-27 12:16:58 +05:30
2020-05-26 20:27:13 +05:30
2020-05-26 20:27:13 +05:30
2019-11-14 13:22:29 +02:00
2020-10-29 13:38:38 +02:00
2020-10-29 13:38:38 +02:00
2022-06-27 16:00:34 +03:00
2022-04-13 09:23:52 +03:00
2022-04-13 09:23:52 +03:00
2022-09-13 16:36:38 +03:00
2022-09-13 16:36:38 +03:00
2022-09-13 16:36:38 +03:00
2022-09-13 16:36:38 +03:00
2022-09-08 13:36:30 +03:00
2022-09-23 13:40:42 +03:00
2022-09-23 13:40:42 +03:00
2021-05-05 23:03:01 +03:00
2021-12-25 12:13:03 +01:00
2021-10-11 12:26:43 +03:00
2023-01-03 16:10:02 +02:00
2021-04-24 09:26:49 +03:00
2020-07-31 13:51:28 +03:00
2022-01-26 12:42:17 +02:00
2022-03-03 11:51:25 +02:00
2022-10-05 20:30:57 +03:00
2022-09-12 22:10:39 +04:00
2021-12-25 12:13:03 +01:00
2019-09-06 11:53:10 +02:00
2020-01-15 18:06:24 +01:00
2022-01-19 11:10:45 +11:00
2022-01-19 11:10:45 +11:00
2022-01-19 11:10:45 +11:00
2022-01-19 11:10:45 +11:00
2022-01-19 11:10:45 +11:00
2022-12-13 11:37:33 +02:00
2020-09-21 12:29:00 +03:00
2022-04-20 19:55:17 +05:30
2022-09-13 16:36:38 +03:00
2023-04-06 16:17:50 +04:00
2019-10-30 23:14:44 +01:00
2022-06-27 10:14:37 +03:00
2022-09-13 16:36:38 +03:00
2022-09-13 16:36:38 +03:00
2022-09-12 22:10:39 +04:00
2022-09-13 16:36:38 +03:00
2021-03-02 15:23:56 +02:00
2022-09-13 16:36:38 +03:00
2020-09-22 14:33:03 +03:00
2019-09-05 16:37:32 +03:00
2023-05-19 15:50:20 +03:00
2019-11-20 19:48:03 +07:00
2019-08-16 10:51:20 +03:00
2022-03-15 08:10:35 +02:00
2022-08-02 14:15:39 +02:00
2022-09-12 22:10:39 +04:00
2020-04-16 12:12:26 +03:00
2020-06-05 18:05:22 +03:00