Skip to content

nemoclaw-start.sh Lacks Signal Handlers — SIGTERM Orphans Child Processes - IssueFinder - SN 05 #1427

@dinuduke

Description

@dinuduke

Description

Description

The nemoclaw-start.sh script has no signal handlers. When SIGTERM is received (e.g., Docker stop, K8s pod termination), child processes are orphaned rather than gracefully shut down. This can lead to data corruption in running agent tasks.

Affected Area

  • File(s): scripts/nemoclaw-start.sh
  • Service(s): Container lifecycle

Related GitHub Issue Check

Notes

Tracked at #1015 with contributor assigned.

Reproduction Steps

Reproduction Steps

  1. Start NemoClaw inside Docker (runs nemoclaw-start.sh as PID 1)
  2. Send SIGTERM to the container:
    docker stop <container-id>
  3. Observe: Docker waits the full stop timeout (10s default) then sends SIGKILL
  4. The gateway and child processes are not gracefully shut down
  5. Verify no trap is set:
    grep -n 'trap' scripts/nemoclaw-start.sh

Environment

Environment

  • OS: Linux (inside Docker container)
  • NemoClaw Version: v0.1.0
  • Branch: main
  • Runtime: Bash (nemoclaw-start.sh as PID 1 / ENTRYPOINT)
  • Container / Orchestration Info: Docker container
  • Network Setup: N/A

Repository

Debug Output

# Verify nemoclaw-start.sh runs as PID 1:
docker exec <container-id> cat /proc/1/cmdline | tr '\0' ' '
# Expected: /usr/local/bin/nemoclaw-start /bin/bash

# Check if any signal trap is set:
grep -n 'trap' scripts/nemoclaw-start.sh
# No SIGTERM/SIGINT trap found — signals are not forwarded to children

# Test graceful shutdown:
docker stop --time=2 <container-id>
docker logs <container-id> 2>&1 | tail -5
# Should see abrupt termination, not graceful shutdown messages

Logs

# Docker stop output:
$ docker stop --time=2 nemoclaw-container
# ... waits 2 seconds, then SIGKILL ...
# No "Shutting down gateway..." or "Cleanup complete" messages
# Gateway process killed without cleanup — may leave stale PID files / sockets

Checklist

  • I confirmed this bug is reproducible
  • I searched existing issues and this is not a duplicate

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstatus: triageFor new items that haven't been reviewed yet.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions