Skip to content

fix: replace invalid utf-8 sequences in agent logs #13436

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

Merged
merged 2 commits into from
Jun 10, 2024
Merged

fix: replace invalid utf-8 sequences in agent logs #13436

merged 2 commits into from
Jun 10, 2024

Conversation

kylecarbs
Copy link
Member

Fixes #13433.

@kylecarbs kylecarbs requested a review from spikecurtis June 3, 2024 00:42
@kylecarbs kylecarbs self-assigned this Jun 3, 2024
Copy link
Contributor

@spikecurtis spikecurtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have a regression test

@MrPeacockNLB
Copy link
Contributor

MrPeacockNLB commented Jun 3, 2024

Is it possible to backport this to stable branch? We are facing this error in production too. Coder Version v2.10.3

@@ -348,7 +348,7 @@ func ProtoFromLog(log Log) (*proto.Log, error) {
}
return &proto.Log{
CreatedAt: timestamppb.New(log.CreatedAt),
Output: log.Output,
Output: strings.ToValidUTF8(log.Output, ""),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should probably replace invalid utf-8 with something, so it's obvious data is being deleted.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we get cute and replace with something like ❌ or 😞 or 🤬, or just something like <<invalid UTF-8>>?

Signed-off-by: Spike Curtis <spike@coder.com>
@spikecurtis
Copy link
Contributor

Decided to just be bold and add the regression test and replacement with ❌ --- @coadler @kylecarbs revert me if you disagree.

@spikecurtis spikecurtis requested a review from coadler June 7, 2024 10:43
@spikecurtis spikecurtis merged commit 7c081dc into main Jun 10, 2024
27 checks passed
@spikecurtis spikecurtis deleted the utf8logs branch June 10, 2024 11:27
@github-actions github-actions bot locked and limited conversation to collaborators Jun 10, 2024
@spikecurtis
Copy link
Contributor

Is it possible to backport this to stable branch? We are facing this error in production too. Coder Version v2.10.3

@MrPeacockNLB I think our policy for fixes unrelated to security is to backport to stable, which is 2.11 as of today.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Coder agent crashes when script log contains invalid UTF-8
4 participants