File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -3945,11 +3945,19 @@ def test_shared_memory_cleaned_after_process_termination(self):
39453945 # segment should not leak the given memory segment.
39463946 p .terminate ()
39473947 p .wait ()
3948- time .sleep (1.0 ) # wait for the OS to collect the segment
39493948
3950- # The shared memory file was deleted.
3951- with self .assertRaises (FileNotFoundError ):
3952- smm = shared_memory .SharedMemory (name , create = False )
3949+ deadline = time .monotonic () + 60
3950+ t = 0.1
3951+ while time .monotonic () < deadline :
3952+ time .sleep (t )
3953+ t = min (t * 2 , 5 )
3954+ try :
3955+ smm = shared_memory .SharedMemory (name , create = False )
3956+ except FileNotFoundError :
3957+ break
3958+ else :
3959+ raise AssertionError ("A SharedMemory segment was leaked after"
3960+ " a process was abruptly terminated." )
39533961
39543962 if os .name == 'posix' :
39553963 # A warning was emitted by the subprocess' own
You can’t perform that action at this time.
0 commit comments