vfdev
ce2f005594
Fixed data race in all_type_info in free-threading mode ( #5419 )
...
* Fix data race all_type_info_populate in free-threading mode
Description:
- fixed data race all_type_info_populate in free-threading mode
- added test
For example, we have 2 threads entering `all_type_info`.
Both enter `all_type_info_get_cache`` function and
there is a first one which inserts a tuple (type, empty_vector) to the map
and second is waiting. Inserting thread gets the (iter_to_key, True) and non-inserting thread
after waiting gets (iter_to_key, False).
Inserting thread than will add a weakref and will then call into `all_type_info_populate`.
However, non-inserting thread is not entering `if (ins.second) {` clause and
returns `ins.first->second;`` which is just empty_vector.
Finally, non-inserting thread is failing the check in `allocate_layout`:
```c++
if (n_types == 0) {
pybind11_fail(
"instance allocation failed: new instance has no pybind11-registered base types");
}
```
* style: pre-commit fixes
* Addressed PR comments
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-11-07 09:32:09 -08:00
..
2024-09-13 00:18:29 -04:00
2024-06-22 00:55:00 -04:00
2024-10-07 14:12:04 -07:00
2024-10-07 14:12:04 -07:00
2024-09-13 00:18:29 -04:00
2024-10-07 14:12:04 -07:00
2024-07-29 11:10:03 -07:00
2024-06-18 13:54:38 -07:00
2024-06-18 13:54:38 -07:00
2024-09-17 09:47:20 -07:00
2024-06-18 13:54:38 -07:00
2024-10-07 14:12:04 -07:00
2024-09-13 00:18:29 -04:00
2024-09-13 00:18:29 -04:00
2024-09-13 00:18:29 -04:00
2024-08-22 00:27:50 -04:00
2022-02-10 12:17:07 -08:00
2024-06-18 13:54:38 -07:00
2024-11-07 09:32:09 -08:00
2024-11-07 09:32:09 -08:00
2024-08-14 18:21:04 -04:00
2024-05-24 12:26:40 -04:00
2024-10-07 14:12:04 -07:00
2022-02-10 12:17:07 -08:00
2024-09-03 10:51:21 -04:00
2024-11-05 10:14:24 -08:00
2024-11-05 10:14:24 -08:00
2024-04-02 11:14:08 -04:00
2024-07-30 09:18:35 -07:00
2024-10-07 14:12:04 -07:00
2024-10-25 08:28:15 -07:00
2024-10-07 14:12:04 -07:00
2024-10-07 14:12:04 -07:00
2022-02-10 12:17:07 -08:00
2024-06-22 00:55:00 -04:00
2024-10-12 11:19:50 -07:00
2024-11-07 09:32:09 -08:00
2022-02-14 11:36:22 -08:00
2024-06-22 00:55:00 -04:00
2024-03-26 13:57:05 -04:00
2024-06-22 00:55:00 -04:00
2024-06-24 08:59:55 -07:00
2024-10-25 08:28:15 -07:00
2024-09-13 00:18:29 -04:00
2024-09-13 00:18:29 -04:00
2024-09-13 00:18:29 -04:00
2024-10-07 14:12:04 -07:00
2024-04-02 11:14:08 -04:00
2024-10-25 08:28:15 -07:00
2021-09-24 12:08:22 -07:00
2024-10-07 14:12:04 -07:00
2024-04-02 11:14:08 -04:00
2024-06-22 00:55:00 -04:00
2024-08-22 00:27:50 -04:00
2024-10-25 08:28:15 -07:00
2022-12-20 05:34:00 -08:00
2024-07-29 11:10:03 -07:00
2024-10-07 14:12:04 -07:00
2022-02-10 12:17:07 -08:00
2024-10-07 14:12:04 -07:00
2024-06-22 00:55:00 -04:00
2022-02-10 12:17:07 -08:00
2024-10-07 14:12:04 -07:00
2024-09-17 09:47:20 -07:00
2023-08-07 20:48:20 -07:00
2024-10-11 20:36:41 -07:00
2022-02-14 11:36:22 -08:00
2024-10-07 14:12:04 -07:00
2022-10-30 08:57:23 -07:00
2024-10-07 14:12:04 -07:00
2022-02-14 11:36:22 -08:00
2024-10-07 14:12:04 -07:00
2024-09-24 10:28:22 -07:00
2024-10-07 14:12:04 -07:00
2022-02-10 12:17:07 -08:00
2024-06-22 00:55:00 -04:00
2024-04-02 11:14:08 -04:00
2024-10-07 14:12:04 -07:00
2024-07-29 11:10:03 -07:00
2024-10-07 14:12:04 -07:00
2022-02-10 12:17:07 -08:00
2024-10-07 14:12:04 -07:00
2024-04-02 11:14:08 -04:00
2024-10-07 14:12:04 -07:00
2024-07-29 11:10:03 -07:00
2024-06-22 00:55:00 -04:00
2022-05-26 11:07:40 -04:00
2024-06-22 00:55:00 -04:00
2024-08-22 00:27:50 -04:00
2024-10-25 08:28:15 -07:00
2022-11-28 07:39:38 -08:00
2024-10-25 08:28:15 -07:00
2022-05-02 12:39:36 -07:00
2024-10-07 14:12:04 -07:00
2023-11-08 12:44:04 -08:00
2024-06-22 00:55:00 -04:00
2024-10-11 20:33:13 -07:00
2024-10-11 20:33:13 -07:00
2024-08-22 00:27:50 -04:00
2024-10-07 14:12:04 -07:00
2024-08-22 00:27:50 -04:00
2024-10-07 14:12:04 -07:00
2024-04-02 11:14:08 -04:00
2024-10-08 10:49:35 -07:00
2024-08-22 00:27:50 -04:00
2024-10-07 14:12:04 -07:00
2024-08-22 00:27:50 -04:00
2024-06-22 00:55:00 -04:00
2024-05-10 17:03:51 -04:00
2024-07-18 14:50:38 -04:00
2024-10-07 14:12:04 -07:00
2024-06-22 00:55:00 -04:00
2024-08-09 13:28:12 -07:00
2024-08-09 13:28:12 -07:00
2019-06-11 23:28:58 +02:00
2024-06-22 00:55:00 -04:00
2023-04-25 14:03:24 -07:00
2024-06-22 00:55:00 -04:00
2023-04-25 14:03:24 -07:00
2024-06-22 00:55:00 -04:00
2023-04-27 07:24:48 -07:00
2024-06-22 00:55:00 -04:00
2024-08-22 00:27:50 -04:00
2024-10-07 14:12:04 -07:00
2024-08-28 20:55:50 -07:00
2024-08-28 20:55:50 -07:00
2021-07-04 19:58:35 -04:00
2021-01-31 17:29:09 -05:00