Skip to content

Commit 1130f6a

Browse files
greateggsgregfilmor
authored andcommitted
Drop the per-loop CLR GC.Collect from concurrent-gc test to avoid Mono+FT+x64 deadlock
1 parent dfda807 commit 1130f6a

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

‎tests/test_thread.py‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -332,22 +332,20 @@ def test_concurrent_gc_collect_on_clr_cycles():
332332
"""
333333
import gc
334334
import System
335-
from System import GC
336335

337336
class Cycle(System.Object):
338337
__namespace__ = "test_concurrent_gc_collect_on_clr_cycles"
339338

340339
def churn(_):
341-
# CLR GC.Collect in the loop tightens the window where the wrapper is
342-
# only weakly held during NewObjectToPython's strong→weak→strong dance,
343-
# so the race surfaces in a single test invocation instead of relying
344-
# on incidental GC pressure.
345-
for _ in range(400):
340+
# Sporadic repro is intentional: the NewObjectToPython race only fires
341+
# when .NET GC happens to fire during construction. Across the CI
342+
# matrix this catches regressions reliably without the heavyweight
343+
# CLR GC.Collect that deadlocks Mono on x64 Ubuntu.
344+
for _ in range(100):
346345
a, b = Cycle(), Cycle()
347346
a.peer = b
348347
b.peer = a
349348
del a, b
350-
GC.Collect()
351349
gc.collect()
352350
return True
353351

0 commit comments

Comments
 (0)