Skip to content

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

Closed
@NiklasRosenstein

Description

@NiklasRosenstein

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    s2Broken use cases or features (with a workaround). Only humans may set this.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions