A partially written live command result aborts polling with JSONDecodeError
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start in lean/components/docker/docker_manager.py at read_from_file: move the json.loads(output) inside the polling loop so an incomplete payload is retried rather than aborting, while a complete result still returns on the first read. Reproduce first with the mocked subprocess returning b'{"Success":' and then full JSON, as in the issue's reproduction, and check the existing docker manager tests for the polling helpers to extend. Done means the incomplete-read case returns the later complete result within the timeout and still fails cleanly once the window expires; the Lean-side producer Common/Commands/FileCommandHandler.cs is context, not a file to change here.
Written by the indexing model from the issue text.
Description
Problem
DockerManager.read_from_file stops polling on any nonempty output and only parses JSON afterward. Lean's FileCommandHandler.Acknowledge writes result files using File.WriteAllText, so a read overlapping that write can observe a nonempty prefix and abort with JSONDecodeError, even if the full successful result becomes available within the timeout.
Reproduction
On current master, mock a running container and a subprocess whose stdout.read() returns b'{"Success":'. Call read_from_file('container', Path('result.json'), interval=0.01, timeout=0.1).
Observed: JSONDecodeError: Expecting value: line 1 column 12 (char 11) after the first read, instead of retrying. Returning complete JSON on the next attempt cannot help because the polling loop has already ended.
Relevant code: lean/components/docker/docker_manager.py, the nonempty-output check and subsequent loads(output) in read_from_file; producer: Common/Commands/FileCommandHandler.cs in Lean.
Required result
A result observed during an incomplete write must not abort a command that completes within its wait window. Preserve immediate handling of a complete result and bound retries for an incomplete result. Suggestion: parse inside the polling loop and retry incomplete JSON, or make the producer publish complete files atomically.
- 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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from QuantConnect/lean-cli
-
priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
QuantConnect/lean-cli#792 ·
Maintainers usually reply within 1 day
-
priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
QuantConnect/lean-cli#786 ·
Maintainers usually reply within 1 day
-
priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
QuantConnect/lean-cli#785 ·
Maintainers usually reply within 1 day
-
Container lookup failures during result polling are masked by UnboundLocalErrorPossibly taken @pcbeingused333 claimed this 5 days ago. Openpriority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
QuantConnect/lean-cli#783 ·
Maintainers usually reply within 1 day
-
priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
QuantConnect/lean-cli#778 ·
Maintainers usually reply within 1 day
All issues in QuantConnect/lean-cli
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pimutils/vdirsyncer#1242 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
open-webui/open-webui#35360 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Suggest link: Destiny Verify (MIT zero-dependency pre-commit security, citation & link hygiene CLI)Open
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day