Version: 2026.3.2 | OS: Linux 6.17.0-14-generic x86_64 | Component: systemd unit, process lifecycle
Summary
Each gateway crash/restart leaves orphaned child processes in the service cgroup. Systemd logs the following after each restart:
openclaw-gateway.service: Unit process 3621786 (bash) remains running after unit stopped.
This usually indicates unclean termination of a previous run, or service implementation deficiencies.
Observed Orphaned Processes
bash, openclaw, openclaw-gatewa, lsof, systemctl
These are child processes spawned by the gateway's bash startup chain that are not cleaned up when the service stops.
Impact
Root Cause
The generated systemd unit likely uses KillMode=process (or omits KillMode), which only sends the stop signal to the main process. Child processes spawned by the gateway's startup wrapper are not terminated.
Suggested Fix
Set KillMode=control-group in the generated systemd unit file so that all processes in the service cgroup are terminated when the service stops:
[Service]
KillMode=control-group
This is the systemd default but should be set explicitly in the generated unit to prevent regression. Alternatively, ensure the gateway's shutdown handler explicitly terminates all child processes before exiting.
Version: 2026.3.2 | OS: Linux 6.17.0-14-generic x86_64 | Component: systemd unit, process lifecycle
Summary
Each gateway crash/restart leaves orphaned child processes in the service cgroup. Systemd logs the following after each restart:
Observed Orphaned Processes
bash,openclaw,openclaw-gatewa,lsof,systemctlThese are child processes spawned by the gateway's bash startup chain that are not cleaned up when the service stops.
Impact
Root Cause
The generated systemd unit likely uses
KillMode=process(or omitsKillMode), which only sends the stop signal to the main process. Child processes spawned by the gateway's startup wrapper are not terminated.Suggested Fix
Set
KillMode=control-groupin the generated systemd unit file so that all processes in the service cgroup are terminated when the service stops:This is the systemd default but should be set explicitly in the generated unit to prevent regression. Alternatively, ensure the gateway's shutdown handler explicitly terminates all child processes before exiting.