Skip to content

Properly await for terminated processes#5

Draft
jprotopopov-ut wants to merge 3 commits intosim642:masterfrom
jprotopopov-ut:master
Draft

Properly await for terminated processes#5
jprotopopov-ut wants to merge 3 commits intosim642:masterfrom
jprotopopov-ut:master

Conversation

@jprotopopov-ut
Copy link

Upon running current script version on goblint VM, I have frequently encountered the following exception when any of sanitizer subprocesses finds a data race:

Exception ignored in: <function BaseSubprocessTransport.__del__ at 0x7ccc248d3c40>                                                                                                                                                                                                                                                                                                          
Traceback (most recent call last):                                                                                                                                                                                                                                                                                                                                                          
  File "/usr/lib/python3.12/asyncio/base_subprocess.py", line 126, in __del__                                                                                                                                                                                                                                                                                                               
    self.close()                                                                                                                                                                                                                                                                                                                                                                            
  File "/usr/lib/python3.12/asyncio/base_subprocess.py", line 104, in close                                                                                                                                                                                                                                                                                                                 
    proto.pipe.close()                                                                                                                                                                                                                                                                                                                                                                      
  File "/usr/lib/python3.12/asyncio/unix_events.py", line 568, in close                                                                                                                                                                                                                                                                                                                     
    self._close(None)                                                                                                                                                                                                                                                                                                                                                                       
  File "/usr/lib/python3.12/asyncio/unix_events.py", line 592, in _close                                                                                                                                                                                                                                                                                                                    
    self._loop.call_soon(self._call_connection_lost, exc)                                                                                                                                                                                                                                                                                                                                   
  File "/usr/lib/python3.12/asyncio/base_events.py", line 795, in call_soon                                                                                                                                                                                                                                                                                                                 
    self._check_closed()                                                                                                                                                                                                                                                                                                                                                                    
  File "/usr/lib/python3.12/asyncio/base_events.py", line 541, in _check_closed                                                                                                                                                                                                                                                                                                             
    raise RuntimeError('Event loop is closed')                                                                                                                                                
RuntimeError: Event loop is closed

The reason seems to be that terminated processes are not awaited and thus the respective subprocess transport might still be alive after the event loop has been closed.

…event loop. Fixes 'Event loop is closed' runtime error in BaseSubprocessTransport destructors
@sim642 sim642 self-requested a review August 12, 2025 08:10
…ecified time reporting that no races were found
@jprotopopov-ut
Copy link
Author

Converting this to a draft to avoid polluting it, as I (mistakenly) pushed some other changes to the same branch. Should any of this seem relevant, feel free to cherry-pick respective commits.

@jprotopopov-ut jprotopopov-ut marked this pull request as draft August 14, 2025 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant