Skip to content

[Bug]: Gateway crash leaves orphaned child processes (bash, openclaw, lsof, systemctl) in cgroup #36793

@wlcarden

Description

@wlcarden

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions