Closed
Description
With the Coder agent configured as a systemd service, when a workspace is updated, the agent will no longer be shown as connected in the UI and the running agent displays a warning level log with "Error: build is outdated". The coder agent does not exit however. If it did, systemd would just restart it and everything would be happy again. I could restart it as part of a Terraform null_resource, but I think the coder agent behavior should just be improved.
Couple points:
- Why can't the coder agent handle this situation automatically? Either reinitializing the outdated parts internally, or forking a new copy of itself.
- In this situation if it's just going to perpetually fail to connect and log errors, why doesn't it just exit?
- If changes to this behavior aren't desired for some reason, could there at least be a flag added to make it an option to exit?
● coder.service - Coder.com Agent
Loaded: loaded (/etc/systemd/system/coder.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2022-08-12 13:54:35 UTC; 1h 4min ago
Docs: https://github.com/coder/coder
Main PID: 505 (coder)
Tasks: 48 (limit: 9403)
Memory: 444.0M
CGroup: /system.slice/coder.service
├─ 505 ./coder agent
├─1251 /usr/lib/code-server/lib/node /usr/lib/code-server --auth none --port 13337
├─1270 /usr/lib/code-server/lib/node /usr/lib/code-server --auth none --port 13337
├─1284 /usr/lib/code-server/lib/node /usr/lib/code-server/lib/vscode/out/bootstrap-fork --type=ptyHost
└─3996 /bin/bash -l
Aug 12 14:58:24 mkulka-coder-test.local coder_bootstrap_linux.sh[505]: Error: build is outdated
Aug 12 14:58:34 mkulka-coder-test.local coder_bootstrap_linux.sh[505]: 2022-08-12 14:58:34.565 [WARN] <./agent/agent.go:140> (*agent).run failed to dial ...
Aug 12 14:58:34 mkulka-coder-test.local coder_bootstrap_linux.sh[505]: "error": GET https://mkulka-coder.local:8443/api/v2/workspaceagents/me/listen: unexpected status code 403>
Aug 12 14:58:34 mkulka-coder-test.local coder_bootstrap_linux.sh[505]: Error: build is outdated
Aug 12 14:58:44 mkulka-coder-test.local coder_bootstrap_linux.sh[505]: 2022-08-12 14:58:44.568 [WARN] <./agent/agent.go:140> (*agent).run failed to dial ...
Aug 12 14:58:44 mkulka-coder-test.local coder_bootstrap_linux.sh[505]: "error": GET https://mkulka-coder.local:8443/api/v2/workspaceagents/me/listen: unexpected status code 403>
Aug 12 14:58:44 mkulka-coder-test.local coder_bootstrap_linux.sh[505]: Error: build is outdated
Aug 12 14:58:54 mkulka-coder-test.local coder_bootstrap_linux.sh[505]: 2022-08-12 14:58:54.571 [WARN] <./agent/agent.go:140> (*agent).run failed to dial ...
Aug 12 14:58:54 mkulka-coder-test.local coder_bootstrap_linux.sh[505]: "error": GET https://mkulka-coder.local:8443/api/v2/workspaceagents/me/listen: unexpected status code 403>
Aug 12 14:58:54 mkulka-coder-test.local coder_bootstrap_linux.sh[505]: Error: build is outdated