Skip to content

Coder agent crashes when script log contains invalid UTF-8 #13433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
NiklasRosenstein opened this issue Jun 1, 2024 · 1 comment · Fixed by #13436
Closed

Coder agent crashes when script log contains invalid UTF-8 #13433

NiklasRosenstein opened this issue Jun 1, 2024 · 1 comment · Fixed by #13436
Labels
s2 Broken use cases or features (with a workaround). Only humans may set this.

Comments

@NiklasRosenstein
Copy link
Contributor

I've had a mistake in my ~/personalize script that I run from a coder_script resource, such that the contents of a .tgz downloaded with cURL were printed to stdout instead of written to a file. This resulted in the Coder agent crashing:

Jun 01 21:18:55 coder-niklas-test coder-agent[9126]: 2024-06-01 21:18:55.222 [warn]  metadata: metadata collection timed out  key=cpu_usage  timeout=1s
Jun 01 21:18:55 coder-niklas-test coder-agent[9126]: 2024-06-01 21:18:55.223 [warn]  metadata: metadata collection timed out  key=ram_usage  timeout=1s
Jun 01 21:18:55 coder-niklas-test coder-agent[9126]: 2024-06-01 21:18:55.245 [warn]  run exited with error ...
Jun 01 21:18:55 coder-niklas-test coder-agent[9126]:     error= error in routine send logs:
Jun 01 21:18:55 coder-niklas-test coder-agent[9126]:                github.com/coder/coder/v2/agent.(*apiConnRoutineManager).start.func1
Jun 01 21:18:55 coder-niklas-test coder-agent[9126]:                    /home/runner/actions-runner/_work/coder/coder/agent/agent.go:2025
Jun 01 21:18:55 coder-niklas-test coder-agent[9126]:              - failed to upload logs:
Jun 01 21:18:55 coder-niklas-test coder-agent[9126]:                github.com/coder/coder/v2/codersdk/agentsdk.(*LogSender).SendLoop
Jun 01 21:18:55 coder-niklas-test coder-agent[9126]:                    /home/runner/actions-runner/_work/coder/coder/codersdk/agentsdk/logs.go:433
Jun 01 21:18:55 coder-niklas-test coder-agent[9126]:              - string field contains invalid UTF-8

This is sub-par for the user experience and maintenance, as a crashing agent means no way for the user to get into the workspace and fix the script.

@coder-labeler coder-labeler bot added the bug label Jun 1, 2024
@kylecarbs
Copy link
Member

Will fix ASAP. Thank you!

@matifali matifali added the s2 Broken use cases or features (with a workaround). Only humans may set this. label Jun 2, 2024
spikecurtis added a commit that referenced this issue Jun 10, 2024
* fix: replace invalid utf-8 sequences in agent logs

Fixes #13433.

* fix: replace invalid UTF-8 with ❌, add regression

Signed-off-by: Spike Curtis <spike@coder.com>

---------

Signed-off-by: Spike Curtis <spike@coder.com>
Co-authored-by: Spike Curtis <spike@coder.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s2 Broken use cases or features (with a workaround). Only humans may set this.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants