FULL AI ANALYSIS

Containerized Python worker aborts with SIGABRT only when launched from systemd timer unit

Generated Oct 22, 2026, 9:30:52 AM

Analysis summary

Differences between interactive shells and systemd-launched processes frequently include environment variables, ulimits, cgroup resource restrictions, and absence of a full PAM/login session. A native extension abort suggests it encountered an unexpected runtime condition (missing resource, invalid locale, lack of entropy, or file-descriptor inheritance). systemd timers run services without a TTY, may set different limits and may not allocate pts/tty; additionally, systemd may launch processes with a minimal environment (LANG, PATH) and with different /proc/self/limits via cgroups which can trigger library-level assertions in C code.

Possible causes

Missing runtime environment variables (LANG/LC_ALL, LD_LIBRARY_PATH) or different PATH causing the C-extension to load incompatible library and abort.

65%

Systemd-imposed cgroup limits or differing RLIMITs (nofile, nproc, memlock) cause the extension to detect lack of resources and abort.

55%

Absence of a controlling TTY/pty or different stdin/stdout/stderr handling causing library assertion in native code path.

30%

Race with systemd unit lifecycle (unit killed/restarted) leading to signal delivered at startup before worker stabilises.

20%

Suggested fixes

1

Diagnostic step 1

Re-run the container under systemd-run --unit=debug --slice=machine.slice --pty --scope -- /usr/bin/docker run ... to mimic systemd runtime and capture logs interactively.

2

Diagnostic step 2

Export the full environment seen by interactive run (env) and inject it into the unit file (Environment= or EnvironmentFile=) to compare results.

3

Diagnostic step 3

Configure the systemd unit with LimitNOFILE= and TasksMax= set high, and set KillMode=process to avoid group kills during debugging.

4

Diagnostic step 4

Enable core dumps for the container process from systemd (DefaultLimitCORE=infinity) and copy core to host for analysis; run gdb against core to see failing symbol.

5

Diagnostic step 5

Temporarily add a small wrapper that logs ulimits, /proc/self/limits, and env to a mounted volume at container start to compare interactive vs timer runs.