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-09 16:03:45 -04:00
2024-05-03 06:17:32 -07:00
2024-05-03 06:17:32 -07:00
2024-04-24 16:18:24 +00:00
2024-05-05 19:28:55 +00:00
2024-02-09 17:08:32 -05:00
2024-04-12 07:40:55 +00:00
2023-11-15 16:38:31 +00:00
2024-03-29 13:35:43 -04:00
2024-05-05 03:07:29 +02:00
2024-06-02 10:19:02 -04:00
2024-05-06 20:12:39 -04:00
2024-05-02 18:25:36 -04:00
2024-05-30 21:55:06 +01:00
2023-11-15 16:38:31 +00:00
2024-02-02 13:50:51 +00:00
2024-02-10 00:57:04 +00:00
2024-05-22 17:45:34 +00:00
2024-04-11 23:23:25 +00:00
2024-02-02 12:14:34 +00:00
2024-05-28 12:47:54 -07:00
2023-12-07 13:47:55 +00:00
2023-09-08 17:54:45 +01:00
2023-09-15 15:04:21 -07:00
2024-04-30 22:32:55 +02:00
2024-02-29 08:11:28 -08:00
2024-05-30 21:55:06 +01:00
2024-05-04 12:12:10 +01:00
2024-02-17 10:03:10 +09:00
2024-05-03 16:21:04 -04:00
2024-06-03 20:58:41 +00:00
2024-02-29 08:11:28 -08:00
2024-05-06 23:07:23 -04:00
2024-06-03 15:56:00 -06:00
2024-06-03 15:56:00 -06:00
2023-11-15 16:38:31 +00:00
2024-05-27 17:05:36 +05:30
2024-05-04 21:24:02 +00:00
2024-03-11 11:02:58 -04:00
2024-04-24 09:46:17 +00:00
2024-05-04 08:23:50 +00:00
2024-05-06 20:12:39 -04:00
2024-05-03 06:17:32 -07:00
2024-02-20 09:39:55 +00:00
2024-05-02 13:03:05 -07:00
2024-01-23 11:08:23 -07:00
2024-04-30 15:01:28 -04:00
2024-05-30 14:48:18 +00:00
2024-06-04 09:42:13 -04:00
2023-11-16 12:19:54 -07:00
2024-05-03 11:30:55 -04:00
2024-01-21 01:14:45 +09:00
2024-02-10 00:57:04 +00:00
2024-02-14 00:32:51 +00:00
2024-06-03 17:09:18 -06:00
2024-01-26 19:38:14 -08:00
2024-01-26 19:38:14 -08:00
2024-05-31 14:05:24 -07:00
2024-05-22 00:46:39 +00:00
2024-05-10 17:43:23 +01:00
2024-02-20 16:50:43 +00:00
2023-10-13 09:25:37 +00:00
2024-04-30 12:37:38 -07:00
2024-04-24 16:18:24 +00:00
2024-03-16 21:37:11 +01:00
2023-12-06 15:09:22 +01:00
2024-04-22 12:17:57 -07:00
2024-02-20 13:04:37 -05:00
2024-03-08 09:56:36 -08:00
2024-04-24 16:18:24 +00:00
2024-04-24 16:18:24 +00:00
2024-05-10 10:26:35 -04:00
2024-06-03 15:56:00 -06:00
2024-05-02 19:30:00 +02:00
2024-05-02 19:30:00 +02:00
2024-02-20 16:50:43 +00:00
2024-05-06 20:12:39 -04:00
2023-10-10 08:26:29 +09:00
2024-02-29 08:11:28 -08:00
2024-05-04 15:45:49 +00:00
2024-05-27 19:50:38 -07:00
2024-05-05 12:15:19 +02:00
2023-10-12 14:52:14 +00:00
2024-04-08 12:11:36 -04:00
2024-03-08 00:21:21 +08:00
2024-06-03 17:09:18 -06:00
2024-05-10 08:42:00 -07:00
2023-11-30 11:12:49 +01:00
2024-06-03 15:56:00 -06:00
2024-02-29 08:11:28 -08:00
2024-02-28 09:56:40 +00:00
2024-05-28 12:47:54 -07:00
2024-05-31 14:05:24 -07:00
2024-03-28 15:05:08 +00:00
2024-05-10 15:54:18 +02:00