Commit 3b99350
fix: disable PR_SET_PDEATHSIG (kernel binds it to parent thread, not process)
PR_SET_PDEATHSIG is bound to the *thread* that forked the child, not to the
parent process (man 2 prctl: "the 'parent' in this case is considered to be
the thread that created this process").
rkllama_server runs Flask with threaded=True, so Process.start() for a worker
is executed from a short-lived request-handler thread. As soon as the request
finishes and its thread exits, the kernel delivers SIGTERM to the worker, the
inherited shutdown handler cascades into stop_all() / sys.exit(0), and the
worker dies after serving a single request. The next /api/embed hits the
dying worker, waits the 30s stop_worker timeout, and returns 500.
Turn _set_parent_death_signal() into a documented no-op. Orphan-worker
protection continues to work via _kill_orphaned_workers() at startup.
Fixes #117.
Co-Authored-By: Claude <noreply@anthropic.com>1 parent d8da3b2 commit 3b99350
1 file changed
Lines changed: 5 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
36 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
37 | 38 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 39 | + | |
45 | 40 | | |
46 | 41 | | |
47 | 42 | | |
| |||
0 commit comments