Skip to content

fix(windows): use thin LTO to prevent transcription crash#10

Open
lemale237 wants to merge 1 commit intoMelvynx:mainfrom
lemale237:fix/windows-lto-crash
Open

fix(windows): use thin LTO to prevent transcription crash#10
lemale237 wants to merge 1 commit intoMelvynx:mainfrom
lemale237:fix/windows-lto-crash

Conversation

@lemale237
Copy link
Copy Markdown

Summary

  • Full LTO (lto = true) causes a STATUS_STACK_BUFFER_OVERRUN (0xc0000409) on Windows when whisper.cpp is invoked during transcription
  • The app crashes immediately when the user presses the keyboard shortcut to start recording
  • Switching to lto = "thin" eliminates the stack corruption while still providing link-time optimization

Context

This bug was introduced with the Windows build added in #8. The release v0.7.18 Windows installer works fine until the user triggers transcription, at which point the process crashes silently.

The root cause is that full LTO aggressively optimizes across whisper.cpp's C/C++ code and Rust boundaries, causing stack corruption on Windows MSVC builds.

Change

# Before
[profile.release]
lto = true

# After  
[profile.release]
lto = "thin"

Test plan

  • Built release binary on Windows 11 x64 with lto = "thin"
  • Installed and launched the app successfully
  • Pressed keyboard shortcut → transcription works without crash
  • Verified transcription output is correct

Full LTO (lto = true) causes a STATUS_STACK_BUFFER_OVERRUN (0xc0000409)
on Windows when whisper.cpp is invoked during transcription. This crash
occurs as soon as the user presses the keyboard shortcut to start
recording.

Switching to thin LTO eliminates the stack corruption while still
providing meaningful link-time optimization.

Tested on Windows 11 x64 with the v0.7.18 release build.
@lemale237
Copy link
Copy Markdown
Author

The rust-tests CI failure is not related to this change. The errors are pre-existing on main:

  • E0428: duplicate mod tests in recorder.rs (lines 359 and 562)
  • E0308: type mismatch in run_consumer test call (Vec<f32> vs AudioChunk)

The last CI run on main (#23783797076) also fails with the same errors. This PR only changes lto = truelto = "thin" in Cargo.toml.

DylanBricar added a commit to DylanBricar/Phonara that referenced this pull request Apr 12, 2026
Full LTO (lto = true) causes STATUS_STACK_BUFFER_OVERRUN on MSVC builds
when starting transcription. Thin LTO maintains optimization benefits
while preventing stack corruption.

Cherry-picked from Melvynx#10
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