Skip to content

[Bug] ResourceWarning: unclosed stdout pipe in AcpTransport.stop() #82

@jalvespinto

Description

@jalvespinto

Summary

What happens

ResourceWarning: unclosed file <_io.TextIOWrapper name=6 encoding='UTF-8'>
self._process = None ← transport.py:269

The leak does not cause any existing test to fail and does not appear in gate reports. It is only visible as a ResourceWarning in raw stderr output when running the suite manually.

Root cause

AcpTransport.stop() closes stdin and calls terminate()/wait(), but never closes self._process.stdout, which was opened as subprocess.PIPE. The file descriptor leaks until GC collects it.

Location: runtime/acp/transport.py, stop() method (~line 256–269)

Reproduction Steps

python3 -W error::ResourceWarning -m unittest tests/test_acp_transport.py

Environment

OS: Linux (Ubuntu 24.04)
Python: 3.12
MCO version: 0.9.1

Relevant Artifacts

runtime-gh-report.md

Pre-check

  • I have run ./scripts/run_runtime_gate_tests.sh.
  • I have verified provider auth and CLI availability.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions