Blocking Docker stdout reads bypass the live result polling timeout

Open Beginner friendly
#785 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
docker, python
Domain
cli

Research direction

Start in lean/components/docker/docker_manager.py at the read_from_file method and read the surrounding timeout/interval loop; the unbounded call is the stdout.read() on the Popen handle. Look for existing docker manager tests to see how the method is exercised, then reproduce with a FIFO writer as the issue describes. Done means a Docker exec that holds stdout open returns near the timeout with a diagnostic, any started subprocess is cleaned up, and immediate successful reads still succeed.

Written by the indexing model from the issue text.

Description

priority:P2

Problem

DockerManager.read_from_file checks its timeout only between attempts. Popen(...).stdout.read() has no deadline, so a Docker exec that never closes stdout can block the method indefinitely despite its timeout argument.

Reproduction and evidence

A minimal real-Docker reproduction uses a running Bash container:

  1. Create /tmp/delayed-fifo with mkfifo.
  2. Start another exec that waits 0.6 seconds, then writes {"Success":true} into the FIFO.
  3. Call read_from_file(container_name, Path('/tmp/delayed-fifo'), interval=0.01, timeout=0.05).

On current master, the call returned success after 0.698 seconds, well beyond its 0.05-second timeout. If the writer never writes or closes the FIFO, the read has no bound. The FIFO demonstrates the blocking stream; a stalled Docker exec can leave stdout open in the same way.

Relevant code: lean/components/docker/docker_manager.py, the stdout.read() in read_from_file.

Required result

Waiting for a Docker exec must not bypass the result wait's deadline. On expiry, clean up any subprocess the method started and return a useful timeout diagnostic. Preserve immediate successful reads. Suggestion: use a subprocess communication API with the remaining timeout rather than an unbounded stream read.

Dominant language
Python
Stars
335
Forks
172
Avg merge
6h 54m
Merged PRs (30d)
37

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from QuantConnect/lean-cli

All issues in QuantConnect/lean-cli

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.