Sam Gross
e69d068ad0
gh-117657: Fix race involving GC and heap initialization ( #119923 )
...
The `_PyThreadState_Bind()` function is called before the first
`PyEval_AcquireThread()` so it's not synchronized with the stop the
world GC. We had a race where `gc_visit_heaps()` might visit a thread's
heap while it's being initialized.
Use a simple atomic int to avoid visiting heaps for threads that are not
yet fully initialized (i.e., before `tstate_mimalloc_bind()` is called).
The race was reproducible by running:
`python Lib/test/test_importlib/partial/pool_in_threads.py`.
2024-06-04 09:42:13 -04:00
..
2024-05-05 21:32:23 +02:00
2024-05-16 20:27:59 +00:00
2024-04-04 15:47:26 +00:00
2024-01-16 09:32:01 +00:00
2024-05-29 09:51:19 +02:00
2024-05-03 06:17:32 -07:00
2024-06-03 20:58:41 +00:00
2023-09-30 22:21:20 +00:00
2024-06-04 10:22:22 +00:00
2024-06-01 13:59:35 +10:00
2024-05-23 16:59:35 -04:00
2024-05-03 19:49:24 +01:00
2024-06-04 10:22:22 +00:00
2024-05-02 18:25:36 -04:00
2024-05-30 21:55:06 +01:00
2024-02-02 13:50:51 +00:00
2024-04-02 20:35:52 +00:00
2024-02-16 01:01:36 +00:00
2023-11-08 15:39:29 -07:00
2024-02-13 14:56:49 -07:00
2024-06-03 17:09:18 -06:00
2024-04-11 23:23:25 +00:00
2024-04-01 13:02:07 +00:00
2023-10-04 22:50:29 +00:00
2023-10-04 22:50:29 +00:00
2023-10-04 22:50:29 +00:00
2023-10-04 22:50:29 +00:00
2024-05-10 21:08:24 +02:00
2024-06-01 13:59:35 +10:00
2024-04-30 22:32:55 +02:00
2024-06-04 10:22:22 +00:00
2024-05-01 21:51:40 +01:00
2024-03-18 11:13:11 -07:00
2024-03-21 18:20:20 -06:00
2024-05-02 06:32:20 -07:00
2024-06-04 09:42:13 -04:00
2024-02-14 00:32:51 +00:00
2024-06-04 10:22:22 +00:00
2024-06-01 13:59:35 +10:00
2024-05-28 12:01:37 +03:00
2024-01-16 21:54:05 +01:00
2023-09-29 10:56:49 +02:00
2024-05-18 19:44:40 +00:00
2023-12-06 15:09:22 +01:00
2024-06-04 10:22:22 +00:00
2024-05-06 21:16:22 -06:00
2024-05-07 11:47:21 +00:00
2024-04-26 17:20:30 +01:00
2024-05-26 12:37:33 +00:00
2024-04-03 01:10:26 +00:00
2024-05-04 12:12:10 +01:00
2024-05-11 16:19:31 -07:00
2024-04-29 09:54:52 +01:00
2024-05-05 12:15:19 +02:00
2024-05-03 11:30:55 -04:00
2023-10-11 14:44:06 +03:00
2024-02-16 01:01:36 +00:00
2024-05-22 00:46:39 +00:00
2024-05-10 17:43:23 +01:00
2024-05-28 12:45:11 -07:00
2024-05-31 14:05:24 -07:00
2024-05-10 17:43:23 +01:00
2024-06-04 10:22:22 +00:00
2024-06-03 13:42:27 -04:00
2024-04-18 15:20:38 +02:00
2024-05-11 16:19:31 -07:00
2024-05-05 03:07:29 +02:00
2024-05-20 16:54:16 +00:00
2024-05-29 09:51:19 +02:00
2024-06-04 11:39:07 +02:00
2024-06-04 09:42:13 -04:00
2024-05-29 09:51:19 +02:00
2024-05-09 15:30:14 -07:00
2024-05-29 07:56:44 +01:00
2024-05-05 21:32:23 +02:00
2024-05-29 09:51:19 +02:00
2024-06-01 10:04:38 -04:00
2024-05-04 12:11:11 +01:00
2024-05-05 21:32:23 +02:00
2024-02-11 12:45:58 +02:00
2024-01-11 20:31:24 +02:00
2024-06-03 15:48:02 +00:00
2024-06-01 13:59:35 +10:00
2024-05-04 09:39:58 +02:00
2023-11-04 13:59:24 +00:00
2024-05-05 12:15:19 +02:00
2024-02-21 11:46:00 +01:00
2024-03-13 23:53:32 +01:00
2024-04-12 13:56:41 +03:00
2024-05-21 19:51:51 +02:00
2024-06-04 10:22:22 +00:00