Skip to content

The Windows engine player starts: no more 0xC0000409 crash before main reads its arguments - #615

Merged
jonit-dev merged 2 commits into
developfrom
fix/win-player-setvbuf
Nov 5, 2026
Merged

jonit-dev merged 2 commits into
developfrom
fix/win-player-setvbuf

Conversation

@jonit-dev

Copy link
Copy Markdown
Contributor

What is this PR about?

The published win32-x64 engine player (0.3.11) crashes on every start with 0xC0000409 and prints nothing. This happens even with an unknown flag. Fixes #614.

Why does it matter?

No ThreeNative desktop game can run on Windows. The store builds windows-x64 games, and each one would crash on launch.

Root cause

v8_main.cpp begins main() with std::setvbuf(stdout, nullptr, _IOLBF, 0). glibc accepts that. MSVC treats _IOLBF as full buffering and requires 2 <= size. Size 0 goes to the CRT invalid-parameter handler, which fails fast: FAIL_FAST_INVALID_ARG_c0000409.

The fix: Windows writes stdout unbuffered (_IONBF). That keeps the original intent, a live log that a killed player does not lose. Linux and macOS are unchanged.

Proof

Lock

native-release.yml now starts every built player with --tn-smoke and expects exit 2 with that message. Before this, nothing ran the Windows player.

⚠️ Not yet run: the MSVC build of the full player with this fix. The release-proof label runs it, but that is the most expensive board in this repo, so the owner decides.

MSVC treats _IOLBF as full buffering and rejects setvbuf size 0 with a fail-fast
0xC0000409, so the win32 player died in main() before any output. Windows now
writes stdout unbuffered. The release job starts every player with an unknown flag.
@jonit-dev
jonit-dev enabled auto-merge November 5, 2026 05:04
@jonit-dev
jonit-dev added this pull request to the merge queue Nov 5, 2026
Merged via the queue into develop with commit 11bbfb5 Nov 5, 2026
37 checks passed
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.

1 participant