Skip to content

fix: silence openstudio stdout Logger to prevent Polyhedron/Space pollution#49

Merged
brianlball merged 2 commits into
developfrom
fix/openstudio-logger-silence
Apr 11, 2026
Merged

fix: silence openstudio stdout Logger to prevent Polyhedron/Space pollution#49
brianlball merged 2 commits into
developfrom
fix/openstudio-logger-silence

Conversation

@brianlball
Copy link
Copy Markdown
Collaborator

@brianlball brianlball commented Apr 11, 2026

Summary

  • Adds silence_openstudio_stdout_logger() to stdout_suppression.py, called from server.py::main() before redirect_c_stdout_to_stderr(). Sets standardOutLogger level to Fatal via the intended Logger API — primary fix for Polyhedron/Space warnings reaching C stdout during Space::volume().
  • Keeps the existing fd-1→fd-2 redirect as a backstop for SWIG memleak warnings in edge cases and future unknown C stdout writes.
  • Adds 3 regression tests (tests/test_stdout_logger_silence.py) including a falsification test that resets to Warn to prove the pollution is real.
  • Added to CI shard 5.

Fixes #48. Upstream SWIG memleak root cause filed as NatLabRockies/OpenStudio#5608 (PyPI wheel missed #5422's SWIG_PYTHON_SILENT_MEMLEAK define).

Test plan

  • pytest tests/test_stdout_logger_silence.py — 3/3 pass
  • Regression: pytest tests/test_swig_memleak_cleanup.py tests/test_stdio_smoke.py tests/test_concurrent_tools.py tests/test_stdout_logger_silence.py — 8/8 pass
  • CI shard 5 green

🤖 Generated with Claude Code

brianlball and others added 2 commits April 11, 2026 16:00
…out pollution

Two-layer defense at server startup:
1. silence_openstudio_stdout_logger() — new, sets standardOutLogger to
   Fatal via the intended Logger API. Primary fix for Polyhedron/Space
   warnings on stdout during Space::volume() (the bulk of pollution in
   practice).
2. redirect_c_stdout_to_stderr() — unchanged, remains as backstop for
   SWIG memleak warnings in edge cases and future unknown C stdout writes.

Adds 3 regression tests in tests/test_stdout_logger_silence.py including
a falsification test that resets to Warn to prove the pollution is real.

Upstream SWIG memleak root cause filed as NatLabRockies/OpenStudio#5608
(PyPI wheel missed #5422 SWIG_PYTHON_SILENT_MEMLEAK define).

Fixes #48

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- UP020: io.open → builtin open
- SIM115: add noqa (intentional — file outlives function, becomes sys.stdout)
- PTH123: add noqa (fd, not a path — Path.open() inapplicable)
- SIM105: try/except/pass → contextlib.suppress in atexit handler

No behavior change.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@brianlball brianlball merged commit 6ee6a15 into develop Apr 11, 2026
12 checks passed
@brianlball brianlball deleted the fix/openstudio-logger-silence branch April 11, 2026 21:22
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.

Silence openstudio standardOutLogger to prevent Polyhedron/Space stdout pollution

1 participant