Skip to content

fix: bound Docker result reads by the live polling timeout - #793

Open
yutianjiang39 wants to merge 4 commits into
QuantConnect:masterfrom
yutianjiang39:contrib/issue-785
Open

yutianjiang39 wants to merge 4 commits into
QuantConnect:masterfrom
yutianjiang39:contrib/issue-785

Conversation

@yutianjiang39

Copy link
Copy Markdown

Fixes #785. A local lean live command could hang past its result timeout if docker exec kept stdout open. DockerManager.read_from_file now passes the time left on the polling deadline to communicate(). If that wait expires, it kills and reaps the local Docker CLI process, discards any late output, and returns the existing timeout message with the file name and docker logs command.

A result that's ready immediately still returns without sleeping. The deadline bounds the wait for docker exec; it doesn't change container lookup or the retry interval. The function signature and result dictionary stay the same. This PR is limited to the result read in read_from_file; refactoring the existing error handlers or changing other subprocess calls is out of scope.

Tests

Both cases in test_read_from_file_times_out_waiting_for_docker_exec failed on the baseline because it accepted a late success. Both pass with the patch. They check the remaining timeout after a retry and process startup, including when no time is left, and verify that cleanup happens before the method returns the timeout diagnostic.

All 28 tests in tests/components/docker/test_docker_manager.py pass with the patch, including immediate reads, empty-file retries, and filenames with shell metacharacters.

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.

Blocking Docker stdout reads bypass the live result polling timeout

1 participant