Commit b32fdee
committed
Fix #189: don't fall back to fork() on macOS; redirect worker stderr
Two changes for the macOS Tahoe segfault reported in issue #189:
1. process_worker_client.py: drop the spawn -> fork fallback when running
on darwin. macOS Tahoe (26+) widened the set of system libraries that
abort if initialized after fork() — CoreFoundation, Security.framework,
libsystem_trace, libsystem_info — so any library the parent has loaded
(psycopg, getaddrinfo, setproctitle, NSCharacterSet) can crash the
forked child. Letting spawn fail and surfacing it to the caller lets
the in-process fallback in query_execution take over instead.
Cost: query cancellation isn't available when spawn fails. Gain: no
hard crashes ("Worker connection closed.") on macOS.
2. process_worker.py: redirect the worker's stdout/stderr to a log file
and enable faulthandler at entry. The worker can SIGPIPE on libpq
notice writes when its inherited FDs point to a Textual-managed pipe,
and any future C-level fault on the worker side is otherwise invisible
to the parent (the pipe just dies). The log path honors
$SQLIT_WORKER_LOG and defaults to <tmpdir>/sqlit-worker.log.
Refs the celery (Tahoe + setproctitle, celery#9894) and gunicorn
(Tahoe + NSCharacterSet, gunicorn#3526) reports for the broader fork-
safety regression on Tahoe.1 parent f898235 commit b32fdee
2 files changed
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
| 8 | + | |
| 9 | + | |
6 | 10 | | |
7 | 11 | | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
| 15 | + | |
11 | 16 | | |
12 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
13 | 38 | | |
14 | 39 | | |
15 | 40 | | |
| |||
493 | 518 | | |
494 | 519 | | |
495 | 520 | | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
496 | 529 | | |
497 | 530 | | |
498 | 531 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
66 | 74 | | |
67 | 75 | | |
68 | 76 | | |
| |||
0 commit comments