From 371d5d9a2863b04c8ef698e1198147a4c024d798 Mon Sep 17 00:00:00 2001 From: jknapp Date: Sun, 28 Dec 2025 20:09:43 -0800 Subject: [PATCH] Fix infinite spawn loop on Windows PyInstaller builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CRITICAL FIX: Added multiprocessing.freeze_support() to prevent the frozen executable from spawning infinite copies of itself on Windows. The issue: When PyInstaller bundles Python apps that use multiprocessing (which PyTorch, faster-whisper, and RealtimeSTT all use), Windows treats each spawn as a new process that re-executes the script. Without freeze_support(), this creates an infinite loop of processes spawning until the system crashes. The fix: - Added multiprocessing.freeze_support() at the very top of main.py - Called before any imports that might use multiprocessing - Windows-only (wrapped in sys.platform check) - Must be before QApplication or any Qt imports This is a standard requirement for all PyInstaller apps that use multiprocessing on Windows. Resolves: App spawns infinite copies when running from PyInstaller build 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- main.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.py b/main.py index 9d4a3e0..4b87309 100644 --- a/main.py +++ b/main.py @@ -8,8 +8,14 @@ optional multi-user server synchronization. """ import sys +import multiprocessing from pathlib import Path +# CRITICAL: Must be called before anything else on Windows with PyInstaller +# This prevents the infinite spawning loop when the frozen executable runs +if sys.platform == 'win32': + multiprocessing.freeze_support() + # Add project root to Python path project_root = Path(__file__).parent sys.path.insert(0, str(project_root))