From ffee4ed2537e3e8ab587f7042ba91841d9c7a45b Mon Sep 17 00:00:00 2001 From: Manjusaka Date: Mon, 16 Sep 2024 01:34:49 +0800 Subject: [PATCH 1/7] gh-123828: fix data raceing for _waiting_release method in _interpchannelsmodule.c Signed-off-by: Manjusaka --- Modules/_interpchannelsmodule.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/_interpchannelsmodule.c b/Modules/_interpchannelsmodule.c index a8b4a8d76b0eaa..716e7cd1b69eec 100644 --- a/Modules/_interpchannelsmodule.c +++ b/Modules/_interpchannelsmodule.c @@ -1,6 +1,7 @@ /* interpreters module */ /* low-level access to interpreter primitives */ +#include #ifndef Py_BUILD_CORE_BUILTIN # define Py_BUILD_CORE_MODULE 1 #endif @@ -490,12 +491,12 @@ _waiting_release(_waiting_t *waiting, int received) assert(!waiting->received); waiting->status = WAITING_RELEASING; - PyThread_release_lock(waiting->mutex); if (waiting->received != received) { assert(received == 1); waiting->received = received; } waiting->status = WAITING_RELEASED; + PyThread_release_lock(waiting->mutex); } static void From b34e59f7ce4bfb1043b5592c41e84064c5e34015 Mon Sep 17 00:00:00 2001 From: Manjusaka Date: Mon, 16 Sep 2024 02:59:07 +0800 Subject: [PATCH 2/7] remove useless code --- Modules/_interpchannelsmodule.c | 1 - 1 file changed, 1 deletion(-) diff --git a/Modules/_interpchannelsmodule.c b/Modules/_interpchannelsmodule.c index 716e7cd1b69eec..0f05a6584e378a 100644 --- a/Modules/_interpchannelsmodule.c +++ b/Modules/_interpchannelsmodule.c @@ -1,7 +1,6 @@ /* interpreters module */ /* low-level access to interpreter primitives */ -#include #ifndef Py_BUILD_CORE_BUILTIN # define Py_BUILD_CORE_MODULE 1 #endif From 5d929f62ad4056071a274fb1a5b4daf670fe568c Mon Sep 17 00:00:00 2001 From: Manjusaka Date: Sat, 27 Sep 2025 16:16:23 +0800 Subject: [PATCH 3/7] Add news Signed-off-by: Manjusaka --- .../2025-09-27-16-16-15.gh-issue-123828.UDxaxV.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Core_and_Builtins/2025-09-27-16-16-15.gh-issue-123828.UDxaxV.rst diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-09-27-16-16-15.gh-issue-123828.UDxaxV.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-09-27-16-16-15.gh-issue-123828.UDxaxV.rst new file mode 100644 index 00000000000000..b07c46cb2eb004 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2025-09-27-16-16-15.gh-issue-123828.UDxaxV.rst @@ -0,0 +1 @@ +fix data raceing for _waiting_release method in _interpchannelsmodule.c From ddedbe643d24dbd768270b34643457f0cc0a91ba Mon Sep 17 00:00:00 2001 From: Manjusaka Date: Sun, 28 Sep 2025 20:36:22 +0800 Subject: [PATCH 4/7] recovery test Signed-off-by: Manjusaka --- Lib/test/test__interpchannels.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test__interpchannels.py b/Lib/test/test__interpchannels.py index 858d31a73cf4f4..ed5f38f73781f1 100644 --- a/Lib/test/test__interpchannels.py +++ b/Lib/test/test__interpchannels.py @@ -365,7 +365,7 @@ def test_shareable(self): #self.assertIsNot(got, obj) -@skip_if_sanitizer('gh-129824: race on _waiting_release', thread=True) +# @skip_if_sanitizer('gh-129824: race on _waiting_release', thread=True) class ChannelTests(TestBase): def test_create_cid(self): From 18186c91bdc939b10e1cbdbf2c54a0d0be9342bb Mon Sep 17 00:00:00 2001 From: Manjusaka Date: Sun, 28 Sep 2025 20:36:44 +0800 Subject: [PATCH 5/7] remove news Signed-off-by: Manjusaka --- .../2025-09-27-16-16-15.gh-issue-123828.UDxaxV.rst | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Misc/NEWS.d/next/Core_and_Builtins/2025-09-27-16-16-15.gh-issue-123828.UDxaxV.rst diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-09-27-16-16-15.gh-issue-123828.UDxaxV.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-09-27-16-16-15.gh-issue-123828.UDxaxV.rst deleted file mode 100644 index b07c46cb2eb004..00000000000000 --- a/Misc/NEWS.d/next/Core_and_Builtins/2025-09-27-16-16-15.gh-issue-123828.UDxaxV.rst +++ /dev/null @@ -1 +0,0 @@ -fix data raceing for _waiting_release method in _interpchannelsmodule.c From 95d326c72b7dac7d62d6b3b94610706cb383a659 Mon Sep 17 00:00:00 2001 From: Manjusaka Date: Sun, 28 Sep 2025 21:09:50 +0800 Subject: [PATCH 6/7] lint code Signed-off-by: Manjusaka --- Lib/test/test__interpchannels.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Lib/test/test__interpchannels.py b/Lib/test/test__interpchannels.py index ed5f38f73781f1..939bd80bc8ef0c 100644 --- a/Lib/test/test__interpchannels.py +++ b/Lib/test/test__interpchannels.py @@ -365,7 +365,6 @@ def test_shareable(self): #self.assertIsNot(got, obj) -# @skip_if_sanitizer('gh-129824: race on _waiting_release', thread=True) class ChannelTests(TestBase): def test_create_cid(self): From 7d55aa2212e709f584ecaa55c2c78d0bfac6f17a Mon Sep 17 00:00:00 2001 From: Manjusaka Date: Sun, 28 Sep 2025 21:12:01 +0800 Subject: [PATCH 7/7] lint code Signed-off-by: Manjusaka --- Lib/test/test__interpchannels.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test__interpchannels.py b/Lib/test/test__interpchannels.py index 939bd80bc8ef0c..d7cf77368ef9f2 100644 --- a/Lib/test/test__interpchannels.py +++ b/Lib/test/test__interpchannels.py @@ -6,7 +6,7 @@ import time import unittest -from test.support import import_helper, skip_if_sanitizer +from test.support import import_helper _channels = import_helper.import_module('_interpchannels') from concurrent.interpreters import _crossinterp