Skip to content

fix(exec): detach child stdin to /dev/null so commits don't hang on a serial console#118

Merged
github-actions[bot] merged 2 commits into
developfrom
fix/mongodb-serial-tty-hang
Jun 29, 2026
Merged

fix(exec): detach child stdin to /dev/null so commits don't hang on a serial console#118
github-actions[bot] merged 2 commits into
developfrom
fix/mongodb-serial-tty-hang

Conversation

@traviswu-bigstack

@traviswu-bigstack traviswu-bigstack commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it

On a serial-console install (IPMI Serial-over-LAN, /dev/ttyS0), hex_config's commit subprocesses inherit the UART as stdin. Exec() redirected the child's stdout/stderr but left stdin inherited from the parent. Tools that initialize a terminal on stdin — e.g. mongosh during the mongodb module commit — then block forever opening the controlling TTY in tty_port_block_til_ready (waiting for carrier; CLOCAL unset), stalling the entire policy apply at the mongodb stage. VGA/console installs are unaffected because their stdin is not a blocking UART.

Commit subprocesses never read stdin, so this redirects the child's stdin to /dev/null in Exec(), mirroring the existing stdout/stderr /dev/null handling. Commits become independent of console type (serial/SoL vs VGA).

Which issue(s) this PR fixes

Fixes bigstack-oss/cubecos#1016 (the cubecos tracking issue; cubecos picks up this fix via a hex submodule bump).

Special notes for your reviewer

Note

Adds test_exec_stdin_01: gives the parent process a non-/dev/null stdin (/dev/zero) and asserts that an Exec()-spawned child still sees /dev/null. Confirmed it fails without the fix (child inherits /dev/zero) and passes with it. Full hex_sdk_library make test is green (128/128) in the centos9 jail.

Also verified end-to-end downstream: a full serial-console (SoL) CubeCOS install on a build carrying this fix completes all 22 bootstrap stages — the mongodb stage no longer hangs.

Additional documentation

Known-issue note drafted in bigstack-handbook: kb/cubecos/known-issues/mongodb-commit-hang-serial-console.md

🤖 Generated with Claude Code

traviswu-bigstack and others added 2 commits June 26, 2026 18:03
…'t block on a serial console

Exec() redirects the child's stdout/stderr but leaves stdin inherited from the
parent (hex_config). On a serial-console install (IPMI Serial-over-LAN, /dev/ttyS0)
the commit subprocesses inherit that UART as stdin. Tools that initialize a terminal
on stdin -- e.g. mongosh during the mongodb module commit -- then block forever
opening the controlling TTY in tty_port_block_til_ready (waiting for carrier; CLOCAL
unset), stalling the entire policy apply at the mongodb stage.

Commit subprocesses never read stdin, so redirect it to /dev/null, mirroring the
existing stdout/stderr /dev/null handling. This makes commits independent of the
console type (serial/SOL vs VGA).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Travis Wu <travis.wu@bigstack.co>
Add test_exec_stdin_01, which gives the parent process a non-/dev/null
stdin and asserts an Exec()-spawned child still sees /dev/null -- guarding
the serial-console hang fix. Wire a tests/ dir into the SDK library
Makefile, since exec.cpp is compiled directly at the SDK root. Also
condense the inline comment on the stdin redirect.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Travis Wu <travis.wu@bigstack.co>
@traviswu-bigstack traviswu-bigstack force-pushed the fix/mongodb-serial-tty-hang branch from a62821c to f9ec378 Compare June 26, 2026 10:04
@leechienpang leechienpang added the done Merge the pull request label Jun 29, 2026
@github-actions github-actions Bot merged commit f9ec378 into develop Jun 29, 2026
5 checks passed
@github-actions github-actions Bot deleted the fix/mongodb-serial-tty-hang branch June 29, 2026 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

done Merge the pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] MongoDB module commit hangs policy apply on serial-console installs

2 participants