stan-dev / stan-dev/stan

Print statements inside a model are buffered into a stringstream and only printed when log_prob returns

Open
#3,233 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

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.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.