Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stub binary doesn't support sys.executable spawn/multiprocessing #8

Open
freakboy3742 opened this issue Jan 31, 2023 · 3 comments
Open
Labels
bug A crash or error in behavior.

Comments

@freakboy3742
Copy link
Member

freakboy3742 commented Jan 31, 2023

Describe the bug

The stub binary used to start an app is an effective replacement for the python.exe binary; however, it isn't a perfect replacements. multiprocessing in spawn mode will try to invoke sys.executable to spawn a child; it's also common to use subprocess or os.spawn to try and start sys.exectuable to run other Python code as a subprocess. However, the stub binary doesn't support this kind of execution.

Steps to reproduce

  1. Generate a stub Windows app
  2. Add a call to call multiprocessing.Process() and start it with .start()

The subprocess will call the parent process entry point, and fail.

Expected behavior

The function targeted by Process() should be invoked with the provided arguments.

Screenshots

No response

Environment

  • Operating System: All Windows
  • Python version: All
  • Software versions:
    • Briefcase: 0.3.12

Logs

n/a

Additional context

See beeware/briefcase-macOS-app-template#7 for an analogous report on macOS.

One possible solution would be to add some logic to the stub binary to inspect to see if the parent process is "self"; if so, the execution of the app should be modified to behave as if it were a normal Python binary.

Any solution should also be ported to macOS (beeware/briefcase-macOS-Xcode-template#20) and Linux (beeware/briefcase-linux-flatpak-template#10)

@mhsmith
Copy link
Member

mhsmith commented Jan 31, 2023

This issue is worse on Windows, because "fork" mode is unavailable: see beeware/briefcase-macOS-app-template#7 (comment).

@Jzhenli
Copy link

Jzhenli commented Aug 11, 2024

what's the status for this issue?

@freakboy3742
Copy link
Member Author

It's a currently open ticket. The issue is known to exist, and does not have a resolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A crash or error in behavior.
Projects
None yet
Development

No branches or pull requests

3 participants