Skip to content

Using tunnel, killing sudo subprocess does not work (cancel does not work) #6297

@danielsharvey

Description

@danielsharvey

Running sst tunnel and killing the sst process does not kill the tunnel (probably due to sudo'd subprocess).

Reference this code:
https://github.com/sst/sst/blob/19b85a752620151232715a720331aeabd0c1ab4b/cmd/sst/main.go#L93-L98

If I kill the (kill -INT <pid>) this does not work:

  1. The signal is received (see "interrupted" log message)
  2. However the logs indicate an error and the process is not terminated.

Logs:

time=2025-12-24T08:54:56.887+08:00 level=INFO msg="starting tunnel" cmd="[sudo -n -E /opt/sst/tunnel tunnel start --subnets 10.0.4.0/22,10.0.12.0/22,10.0.20.0/22,10.0.0.0/22,10.0.8.0/22,10.0.16.0/22 --host 13.54.105.196 --user ec2-user --print-logs]"
time=2025-12-24T08:56:10.169+08:00 level=INFO msg=interrupted
time=2025-12-24T08:56:10.170+08:00 level=INFO msg="killing process" pid=11724
time=2025-12-24T08:56:10.171+08:00 level=ERROR msg="failed to send sigterm" pid=11724

When I hit CTRL-C from the terminal all subprocesses are killed and I see this in the logs:

...
time=2025-12-24T09:03:21.915+08:00 level=INFO msg="killing process" pid=11724
time=2025-12-24T09:03:21.916+08:00 level=INFO msg="process killed with term" pid=11724
time=2025-12-24T09:03:21.916+08:00 level=INFO msg="untracked process" pid=11724

I suspect the reason CTRL-C works is that the terminal is actually killing the subprocesses (entire process group) and has more permissions to ensure the process is cleaned up.

Does the kill need to operate via sudo?

(sst 3.17.25 - sst-darwin-arm64)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions