Print statements inside a model are buffered into a stringstream and only printed when log_prob returns
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.8k
- Forks
- 388
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 15
Description
Summary:
In situations like https://github.com/stan-dev/cmdstan/issues/1207, where there is an infinite loop which never exits, a user may try to debug-by-print the loop condition. This will never be useful, as the infinite loop prevents the code from exiting and actually logging to the user.
Relevant code:
https://github.com/stan-dev/stan/blob/b22074b57e459132c160c02267566695a634ec54/src/stan/model/gradient.hpp#L25-L35
Current Version:
v2.33.0
Contributor guide
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.
Research direction
Read the linked CmdStan issue and the relevant section of src/stan/model/gradient.hpp at lines 25-35 first. Trace how the model's print stream is buffered around log_prob and determine the expected behavior when execution does not return. The issue is complete once that behavior is agreed and demonstrated with appropriate coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100