Broken macOS builds permanently break the project
Description
When you make a build on macOS (arm) with flet build that causes a crash (e.g. because of a seemingly unsupported dependency), the app will crash the first time and then ALL future builds in the project will show a blank screen when packaged with flet build. This includes if you completely remove the dependency and completely delete the build directory. This gets reset if you just change the directory name (i.e. just copy the files to a new project with a different name). One guess is something is being cached on Mac after the crash and so changing the project name effectively invalidates that.
Simple reproduction steps
Create a simple Hello World app and build for mac using flet build macos
import flet as ft
def main(page: ft.Page):
page.add(ft.Text("Hello World!"))
ft.app(main)
Open the app and observe it works as expected.
Add a dependency that doesn't seem to be working with flet build like numpy (note: I've repro'd this with multiple other seemingly unsupported dependencies so it doesn't seem to be numpy-specific and the real concern here is that broken behavior persists to future clean builds).
import flet as ft
import numpy as np
def main(page: ft.Page):
page.add(ft.Text("Hello World!"))
ft.app(main)
Open the app and observe it crashes. All future attempts to open this app will now show a blank screen with no content (not crash).
Revert the code to remove the dependency and build again using flet build macos
Open the app and observe just a blank screen with no content.
Describe the results you expected:
When the code is reverted and built, the app runs again like before.
Additional information you deem important (e.g. issue happens only occasionally):
Here is the (abridged) log from the crashed thread on first open:
...
Crashed Thread: 22
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x000000016becfff8
Exception Codes: 0x0000000000000002, 0x000000016becfff8
Termination Reason: Namespace SIGNAL, Code 10 Bus error: 10
Terminating Process: exc handler [62572]
VM Region Info: 0x16becfff8 is in 0x16becc000-0x16bed0000; bytes after start: 16376 bytes before end: 7
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
Stack 16bdc4000-16becc000 [ 1056K] rw-/rwx SM=PRV thread 21
---> STACK GUARD 16becc000-16bed0000 [ 16K] ---/rwx SM=NUL ...for thread 22
Stack 16bed0000-16bf58000 [ 544K] rw-/rwx SM=PRV thread 22
...
Thread 22 Crashed:
0 libsystem_pthread.dylib 0x18d587e7c ___chkstk_darwin + 60
1 libopenblas64_.0.dylib 0x139171ce0 dgetrf_parallel + 52
2 libopenblas64_.0.dylib 0x139019b30 dgesv_64_ + 372
3 _umath_linalg.cpython-311-darwin.so 0x11eb11488 void inv<double>(char**, long const*, long const*, void*) + 616
4 _multiarray_umath.cpython-311-darwin.so 0x128736438 generic_wrapped_legacy_loop + 40
5 _multiarray_umath.cpython-311-darwin.so 0x12873db40 ufunc_generic_fastcall + 15976
6 serious_python_darwin 0x105be78ec PyObject_Vectorcall + 80
7 serious_python_darwin 0x105cd7984 _PyEval_EvalFrameDefault + 34524
8 serious_python_darwin 0x105ccf208 _PyEval_Vector + 200
9 serious_python_darwin 0x105be78ec PyObject_Vectorcall + 80
10 _multiarray_umath.cpython-311-darwin.so 0x1286529a8 dispatcher_vectorcall + 628
11 serious_python_darwin 0x105be78ec PyObject_Vectorcall + 80
12 serious_python_darwin 0x105cd7984 _PyEval_EvalFrameDefault + 34524
13 serious_python_darwin 0x105ccf208 _PyEval_Vector + 200
14 serious_python_darwin 0x105be78ec PyObject_Vectorcall + 80
15 _multiarray_umath.cpython-311-darwin.so 0x1286529a8 dispatcher_vectorcall + 628
16 serious_python_darwin 0x105be78ec PyObject_Vectorcall + 80
17 serious_python_darwin 0x105cd7984 _PyEval_EvalFrameDefault + 34524
18 serious_python_darwin 0x105ccf0d8 PyEval_EvalCode + 272
19 serious_python_darwin 0x105ccba18 builtin_exec + 916
20 serious_python_darwin 0x105c3484c cfunction_vectorcall_FASTCALL_KEYWORDS + 160
21 serious_python_darwin 0x105cd95f4 _PyEval_EvalFrameDefault + 41804
22 serious_python_darwin 0x105ccf208 _PyEval_Vector + 200
23 serious_python_darwin 0x105be8f18 object_vacall + 256
24 serious_python_darwin 0x105be8d80 PyObject_CallMethodObjArgs + 92
25 serious_python_darwin 0x105d0d0d4 PyImport_ImportModuleLevelObject + 1308
26 serious_python_darwin 0x105cd4cdc _PyEval_EvalFrameDefault + 23092
27 serious_python_darwin 0x105ccf0d8 PyEval_EvalCode + 272
28 serious_python_darwin 0x105ccba18 builtin_exec + 916
29 serious_python_darwin 0x105c3484c cfunction_vectorcall_FASTCALL_KEYWORDS + 160
30 serious_python_darwin 0x105be78ec PyObject_Vectorcall + 80
31 serious_python_darwin 0x105cd7984 _PyEval_EvalFrameDefault + 34524
32 serious_python_darwin 0x105ccf0d8 PyEval_EvalCode + 272
33 serious_python_darwin 0x105d27bc8 PyRun_StringFlags + 220
34 serious_python_darwin 0x105d2941c PyRun_SimpleString + 60
35 serious_python_darwin 0x105b9b540 specialized SeriousPythonPlugin.runPythonScript(script:) + 48
36 serious_python_darwin 0x105b9ae8c @objc SeriousPythonPlugin.runPythonFile(appPath:) + 64
37 Foundation 0x18e769ff4 __NSThread__start__ + 716
38 libsystem_pthread.dylib 0x18d58d034 _pthread_start + 136
39 libsystem_pthread.dylib 0x18d587e3c thread_start + 8
...
Thread 22 crashed with ARM Thread State (64-bit):
x0: 0x000000016bf4f7a8 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000284000000
x4: 0x0000000284028000 x5: 0x0000000000000000 x6: 0x000000016bf4f920 x7: 0x000000016bf4f940
x8: 0x000000000000000a x9: 0x0000000000084610 x10: 0x000000016becb120 x11: 0x000000016bed0000
x12: 0x0000000000000000 x13: 0x0000000000000000 x14: 0x00000000000007fb x15: 0x00000000c1422016
x16: 0x000000018d587e40 x17: 0x00000000c1621815 x18: 0x0000000000000000 x19: 0x000000016bf4f940
x20: 0x000000016bf4f910 x21: 0x0000000284000000 x22: 0x000000016bf4f908 x23: 0x0000000284000000
x24: 0x0000000284028000 x25: 0x000060000207cf18 x26: 0x0000000000000048 x27: 0x0000000000000020
x28: 0x0000000000000003 fp: 0x000000016bf4f790 lr: 0x0000000139171ce0
sp: 0x000000016bf4f730 pc: 0x000000018d587e7c cpsr: 0x80001000
far: 0x000000016becfff8 esr: 0x92000007 (Data Abort) byte read Translation fault
Flet version (pip show flet):
% pip show flet
Name: flet
Version: 0.22.0
Summary: Flet for Python - easily build interactive multi-platform apps in Python
Home-page:
Author: Appveyor Systems Inc.
Author-email: [email protected]
License: Apache-2.0
Location: /Users/admin/Code/flet-testing2/venv/lib/python3.12/site-packages
Requires: cookiecutter, fastapi, flet-runtime, packaging, qrcode, uvicorn, watchdog
Required-by:
Give your requirements.txt file (don't pip freeze, instead give direct packages):
flet
numpy
Operating system:
M1 Pro Mac - OS X Sonoma 14.1.2
Additional environment details:
Python 3.12.2