Skip to content

Fix headless stdout flooding#645

Merged
cjmyers merged 3 commits intomasterfrom
pr/headless-stdout-fix
Apr 7, 2026
Merged

Fix headless stdout flooding#645
cjmyers merged 3 commits intomasterfrom
pr/headless-stdout-fix

Conversation

@travisformayor
Copy link
Copy Markdown
Contributor

Running simulations through SynBioSuite can fail with ERR_CHILD_PROCESS_STDIO_MAXBUFFER when reb2sac progress output overflows Node.js's buffer in iBioSim-API. In headless mode, Run.java dumps every progress line (Time=X) to stdout, but nothing downstream uses them, they just accumulate until the buffer overflows.

  • Skip System.out.println for lines successfully parsed as progress updates. Diagnostic output (warnings, errors) still prints.
  • GUI path is unchanged, progress still goes through parent.send().
  • Add explicit transitive deps to dataModels/pom.xml so the module builds standalone.
  • Fix http to https for osgeo Maven repo URL.
  • Ignore .sdkmanrc in .gitignore.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces headless simulation failures caused by excessive child-process output by suppressing reb2sac progress-line printing in headless mode, while keeping GUI progress reporting unchanged. It also updates build/infra metadata so modules build more reliably and use secure repository URLs.

Changes:

  • Suppress stdout printing of successfully parsed Time=... progress lines when running headless (no parent), while still printing non-progress diagnostics.
  • Add explicit dependencies to dataModels/pom.xml to support standalone builds and update the osgeo repository URL to HTTPS.
  • Ignore .sdkmanrc in .gitignore.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
analysis/src/main/java/edu/utah/ece/async/ibiosim/analysis/Run.java Avoids printing progress lines to stdout in headless mode to prevent buffer flooding.
dataModels/pom.xml Adds explicit dependencies for standalone builds and switches osgeo repo URL to HTTPS.
.gitignore Ignores .sdkmanrc.
Comments suppressed due to low confidence (1)

analysis/src/main/java/edu/utah/ece/async/ibiosim/analysis/Run.java:901

  • Progress detection uses line.contains("Time") and then unconditionally attempts substring(line.indexOf('=') + 1, ...). If a non-progress diagnostic line contains the word "Time" but not the expected Time=... format, this will throw and e.printStackTrace() will emit a stack trace per line, which can still flood stderr in headless runs. Tighten the condition (e.g., require Time= prefix / regex with = present) and avoid printing full stack traces in this hot loop (log once or include the offending line in a concise message).
						  if (line.contains("Time")) {
							  time = Double.parseDouble(line.substring(line.indexOf('=') + 1, line.length()));
							  isProgress = true;
							  if (oldTime > time) {
								  runNum++;
							  }
							  oldTime = time;
							  time += (runNum * properties.getSimulationProperties().getTimeLimit());
							  double d = ((time * 100) / runTime);
							  String s = d + "";
							  double decimal = Double.parseDouble(s.substring(s.indexOf('.'), s.length()));
							  if (decimal >= 0.5) {
								  prog = (int) (Math.ceil(d));
							  } else {
								  prog = (int) (d);
							  }
						  }
					  }
					  catch (Exception e) {
						  e.printStackTrace();
					  }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@travisformayor travisformayor requested a review from cjmyers April 7, 2026 20:21
@travisformayor travisformayor marked this pull request as ready for review April 7, 2026 20:21
@travisformayor
Copy link
Copy Markdown
Contributor Author

Responded to each copilot review comment, none of them require any code changes

@cjmyers cjmyers merged commit 74ac459 into master Apr 7, 2026
4 checks passed
@cjmyers cjmyers deleted the pr/headless-stdout-fix branch April 7, 2026 21:16
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.

3 participants