pyinstaller / pyinstaller/pyinstaller

PySide6 6.4.1 app periodically hangs straight after launch on macOS Ventura 13.0.1

Open
#7,355 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
13.1k
Forks
2k
Avg merge
1d 3h
Merged PRs (30d)
11

Description

Description of the issue

My PySide6-based app will periodically hang straight after launch on macOS Ventura 13.0.1. It doesn't happen every time - probably 1 in 10 or so launches hang. When I run the code unfrozen, it never hangs. I've reproduced the bug using a really minimal example below: just displaying a single message dialog.

Context information (for bug reports)
  • Output of pyinstaller --version: 5.7.0

  • Version of Python: Python 3.10.9 (v3.10.9:1dd9be6584, Dec 6 2022, 14:37:36) [Clang 13.0.0 (clang-1300.0.29.30)]

  • Platform: macOS Ventura 13.0.1

  • How you installed Python: From python.org (macOS 64-bit universal2 installer)

  • Did you also try this on another platform? Does it work there? Haven't tried yet.

  • try the latest development version: Tried latest devel version - hangs still occur.

    • start with clean installation
    • use the latest development version
    • Run your frozen program from a command window (shell) — instead of double-clicking on it

When I run the frozen app from the command line (./dist/HangTest.app/Contents/MacOS/HangTest) it never seems to hang. The hang only occurs when launched from the Finder.

  • Package your program in --onedir mode
  • Package without UPX, say: use the option --noupx or set upx=False in your .spec-file
  • Repackage you application in verbose/debug mode. For this, pass the option --debug to pyi-makespec or pyinstaller or use EXE(..., debug=1, ...) in your .spec file.
A minimal example program which shows the error

hang_test.py

from PySide6 import QtCore, QtWidgets
from PySide6.QtCore import Qt


def main():
    app = QtWidgets.QApplication()
    QtWidgets.QMessageBox.information(None, "Test", "Hello World!")


if __name__ == "__main__":
    main()

hang_test.spec

# -*- mode: python ; coding: utf-8 -*-


#
# Set various parameters
#
app_version = "0.1.0"
onefile = False
block_cipher = None


#
# Main spec file elements
#
a = Analysis(['hang_test.py'],
        binaries=[],
        datas=[],
        hiddenimports=[],
        hookspath=[],
        runtime_hooks=[],
        excludes=[],
        win_no_prefer_redirects=False,
        win_private_assemblies=False,
        cipher=block_cipher,
        noarchive=False
    )

pyz = PYZ(a.pure, a.zipped_data,
            cipher=block_cipher)

exe = EXE(pyz,
        a.scripts,
        a.binaries if onefile else [],
        a.zipfiles if onefile else [],
        a.datas if onefile else [],
        exclude_binaries=not onefile,
        name='HangTest',
        debug=True,
        bootloader_ignore_signals=False,
        strip=False,
        upx=False,
        upx_exclude=[],
        runtime_tmpdir=None,
        console=False,
        disable_windowed_traceback=False,
        argv_emulation=True,
        target_arch='universal2',
        codesign_identity=None,
        entitlements_file=None,
    )
bundle_obj = exe

if not onefile:
    coll = COLLECT(
            exe,
            a.binaries,
            a.zipfiles,
            a.datas,
            strip=False,
            upx=True,
            upx_exclude=[],
            name='HangTest',
        )
    bundle_obj = coll

app = BUNDLE(bundle_obj,
        name='HangTest.app',
        bundle_identifier="app.hangtest",
        info_plist={
            'CFBundleShortVersionString': app_version,
        }
    )
Stacktrace / full error message

Diagnostic Report with stacktrace attached: HangTest_2022-12-27-225244.hang.txt

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal reproduction in hang_test.py and its hang_test.spec, then launch the generated HangTest.app from Finder on macOS Ventura rather than from the shell. Read the attached HangTest_2022-12-27-225244.hang.txt diagnostic report and compare Finder launches with command-line launches; done means the intermittent post-launch hang is explained and no longer reproducible in this setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, python
Domain
desktop, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.