mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #3238] [Engine] Linux: "exit code -9" with no OOM when started from a PipeWire desktop without rtkit (RLIMIT_RTTIME hard limit 0) #1312
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#1312
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @vthomasino on GitHub (Oct 19, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3238
Area
[Engine] (speed, kernels, models, the server and API)
Desktop app, Terminal or source?
Source (START-HERE.bat, setup.sh or a build)
What happened
The engine sometimes dies at load (while it builds the RAM copy) or during a request:
It was never RAM. There was no OOM kill in dmesg,
oom_killin /proc/vmstat did not move, systemd-oomd logged nothing, and auditd rules on kill/tkill/pidfd_send_signal saw no process send the signal. Since #215 the RAM hint only shows when the OS killed the engine; here the kernel did kill it, but for a different reason.Cause, as far as I traced it
RLIMIT_RTTIME= 0 / 0 (soft / hard) from the shell. Every terminal on this desktop has it (ulimit -Rprints 0, and/proc/<pid>/limitsshows 0/0 for bash and pi).libpipewire-module-rt). With rtkit not installed, the desktop portal answers for it, and the module lowers the limit:mod.rt: clamping rt.time.soft from 18446744073709551615 to 0 because of RTKit(PipeWire 1.6.8, xdg-desktop-portal 1.22.1). The desktop shell is a PipeWire client, so everything started from it inherits 0/0. Withrtkit.enabled = falseandrtportal.enabled = falsein a copy of client.conf, a client keepsunlimited;rlimits.enabled = falsealone does not change it.check_thread_timers()(kernel/time/posix-cpu-timers.c) sends SIGKILL as soon as it checks a thread with an armed per-thread CPU timer:rt.timeoutis 0 for a normal thread, and0 >= 0passes. The thread does not need to be real-time. A tracefssignal:signal_generatetrace caught one engine death:sig=9 errno=0 code=128 comm=strata, sent from inside the process byposix_cpu_timers_work <- task_work_run <- exit_to_user_mode_loop, not by another process.rttime-thread-timer.cin the gist below). It callstimer_create(CLOCK_THREAD_CPUTIME_ID)withSIGEV_SIGNAL, arms 100 ms and spins for 2 s. From this shell it is killed with signal 9 (exit 137); undersystemd-run --user(unlimited) it exits 0. WithSIGEV_NONEit survives.Not found yet: which code in the engine process arms the per-thread CPU timer. Strata's sources do not call
timer_create. Among the engine's loaded libraries, only libc imports it. In one traced session (load plus a 15K-token prompt), no engine thread calledtimer_createortimer_settime, and the engine survived. The deaths are intermittent: 4 in about 24 hours with UD-Q6_K_XL (during a 155K-token prefill, after a short reply, at load, and on a 16K-token prompt).ulimit -ris 0 too, so no thread can switch to SCHED_FIFO, and 900 samples of every thread's scheduling class during a 16K prefill showed none real-time. I have a trace of timer_create/timer_settime with user stacks running, and will add the caller here when it shows up.Workaround used here: start the server as a systemd user service, which takes the user manager's limits (unlimited) instead of the shell's. No -9 since (about 4 hours of use and A/B runs so far).
Installing rtkit should also work (it answers 200 ms instead of 0). I did not test that.
Suggestion: on Linux, when the engine ends with -9, check
resource.getrlimit(resource.RLIMIT_RTTIME)inserve/server.pybefore printing the RAM hint. If the hard limit is finite, say so and name the fix (rtkit, or start Strata outside the desktop session's limits). A warning at start-up in the same case would catch it before the first crash. When the limit is unlimited, neither changes anything. I can send this as a small PR if it is wanted.Smallest steps or command that reproduce it
ulimit -R(0 here).rttime-thread-timer.cfrom https://gist.github.com/vthomasino/aef6f8e2413733cbe149a91178e889d8 : it is killed with signal 9. Run it again withsystemd-run --user --wait: it exits 0.Reproduction status
Reproduced locally
Strata version
Strata 0.2.0-beta · engine 0.1.45.3 (tag v0.2.0-beta,
b73dbce3); the deaths were on 0.1.45, the limit and the workaround are the same on 0.2.0-betaGraphics card, memory and system
RTX 5090 Laptop 24 GB (driver 610.57.04) · 62 GB RAM · Core Ultra 9 275HX · Linux 7.2.5 (Omarchy/Arch, Hyprland), PipeWire 1.6.8, no rtkit
Model, size and settings
unsloth UD-Q6_K_XL · 256K context · pictures on ·
--resident-budget-gib 38Logs
Kernel stack of the kill (tracefs, signal:signal_generate with stacktrace):
@Niko1221 commented on GitHub (Oct 20, 2026):
Thank you for the trace, it made this easy to follow. The limit itself cannot be raised from inside Strata: a hard RLIMIT_RTTIME can only be lowered without extra privileges, and we found no code of ours that arms a per-thread CPU timer either (no timer_create in the engine). So the fix on our side is to say it instead of guessing. In 0.2.1 the server prints a warning at start when the hard limit is finite (naming rtkit and your systemd-run line), and when the engine dies with signal 9 and the limit is finite, the message names the limit first and the RAM hint second. There is a troubleshooting entry with the same words. If your timer_create trace ever shows the caller, please add it here: if it is a library we ship we can look at avoiding it.
This is in Strata 0.2.1: https://github.com/Niko1221/Strata/releases/tag/v0.2.1
@vthomasino commented on GitHub (Oct 20, 2026):
Validated the 0.2.1 warning as shipped (source build, engine binary 0.1.46.1, server from the 0.2.1 tree): I started the server from a shell with a finite limit and it printed this at start:
(After the reboot my desktop session happened to get an unlimited limit, so for the test I started the server under
ulimit -R 200000to stand in for the PipeWire case.)One note on the wording: the hard limit the kernel kills on is what matters, and the warning reads it correctly here. When I have a real death under 0/0 again I will post the exact numbers.
Also, about the caller of the timer: the reboot cleared the tracefs instance I had armed, so I re-armed it (timer_create and timer_settime, with user stacks, 1 MiB per CPU). Nothing has shown up yet in the new session — the deaths were intermittent (4 in ~24 h of long sessions before the reboot). I will add the caller here when the trace catches one. If it is a library you ship, as you said, that would let you look at avoiding it.
@Niko1221 commented on GitHub (Oct 24, 2026):
This is fixed in Strata 0.2.1. Please update to the latest release (in the Terminal:
strata update; in the app: download the newest installer from the releases page). If it still happens on the latest version, reply here and we will reopen it. Thank you for the report.