Skip to content

[BUG] Shutdown always logs error and tries to kill the process #1694

Description

@invario

The bug

Using the shutdown feature always logs an error message and attempts to kill the shutdown process/command, even when successful.

The OS that UpSnap is running on

Docker image

Version of UpSnap

5.2.8

Your docker-compose.yml content

services:
  upsnap:
    cap_add:
      - NET_RAW
    cap_drop:
      - ALL
    deploy:
      resources:
        limits:
          cpus: '2'
          memory: '1073741824'
    environment:
      NVIDIA_VISIBLE_DEVICES: void
      TZ: America/New_York
      UPSNAP_PING_PRIVILEGED: 'true'
    hostname: upsnap
    image: seriousm4x/upsnap:5.2.8
    network_mode: host
    platform: linux/amd64
    privileged: False
    pull_policy: missing
    restart: unless-stopped
    security_opt:
      - no-new-privileges=true
    stdin_open: False
    tty: False
    user: '0:0'
    volumes:
      - bind:
          create_host_path: False
          propagation: rprivate
        read_only: False
        source: /mnt/KTCloud/upsnap
        target: /app/pb_data
        type: bind
volumes: {}

Reproduction steps

1.Setup upsnap.
2.Confirm upsnap works properly (WOL working)
3.Define shutdown command (for me, it was a Windows PC) so I used `net rpc shutdown -I {{ DEVICE_IP }} -U "ADMIN%PASSWORD"`
4.Shutdown the PC
5.Note that the shutdown does work (PC powers off), but it also logs a message ALWAYS:

[INFO] 2026/03/12 09:05:12 shutdown.go:17: Shutdown triggered for COMPUTER
[WARNING] 2026/03/12 09:05:58 shutdown_other.go:21: Your command didn't finish in time. It will be killed.
[ERROR] 2026/03/12 09:05:58 shutdown.go:78: no such process

Additional information

I'm actively working on debugging this on my own but appreciate any help if someone sees something obvious in the code. It seems to me, at a quick glance, that the code isn't detecting that the shutdown command ran successfully and exited basically immediately, so it still loops through waiting when it already finished.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions