8000 fix: avoid type conversion in GetDataSize() by RainofTerra · Pull Request #686 · honeycombio/refinery · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: avoid type conversion in GetDataSize() #686

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
wants to merge 1 commit into from

Conversation

RainofTerra
Copy link
Contributor
@RainofTerra RainofTerra commented May 18, 2023

Which problem is this PR solving?

I hit the following panic repeatedly in one of our refinery clusters:

panic: interface conversion: interface {} is []uint8, not string

goroutine 62 [running]:
github.com/honeycombio/refinery/types.(*Span).GetDataSize(...)
        github.com/honeycombio/refinery/types/event.go:145
github.com/honeycombio/refinery/types.(*Trace).AddSpan(0x446fdbcfd0, 0x4277f52210)
        github.com/honeycombio/refinery/types/event.go:78 +0x304
github.com/honeycombio/refinery/collect.(*InMemCollector).processSpan(0x400042f040, 0x4277f52210)
        github.com/honeycombio/refinery/collect/collect.go:515 +0x2f0
github.com/honeycombio/refinery/collect.(*InMemCollector).collect(0x400042f040)
        github.com/honeycombio/refinery/collect/collect.go:414 +0x30c
created by github.com/honeycombio/refinery/collect.(*InMemCollector).Start
        github.com/honeycombio/refinery/collect/collect.go:158 +0xa4c

Short description of the changes

I changed GetDataSize() case statement so value will now be the type of the v interface. I then added a separate case for []byte (which is also the underlying type of []uint8)

@RainofTerra RainofTerra requested a review from a team May 18, 2023 20:28
@RainofTerra RainofTerra changed the title avoid type conversion in GetDataSize() fix: avoid type conversion in GetDataSize() May 18, 2023
@kentquirk kentquirk changed the base branch from main to v1.21_patch May 18, 2023 20:59
@kentquirk kentquirk changed the base branch from v1.21_patch to main May 18, 2023 20:59
kentquirk added a commit that referenced this pull request May 18, 2023
kentquirk added a commit that referenced this pull request May 18, 2023
## Which problem is this PR solving?

Panics on certain events due to attempt to assert []byte to string.

## Short description of the changes

Handle each case separately

Original work by @RainofTerra in #686 but we need a patch to a previous
release.
@kentquirk kentquirk added the wip Work In Progress label May 19, 2023
@kentquirk kentquirk added this to the v2.0 milestone May 19, 2023
@kentquirk
Copy link
Contributor

This has been patched on a branch with a tag at bug_fix_1.22_20230519, and that patch will be cherry-picked into 2.0. I've marked it as WIP so it doesn't get merged accidentally.

@kentquirk
Copy link
Contributor

An equivalent fix has been merged to 2.0.

@kentquirk kentquirk closed this Jun 3, 2023
@kentquirk kentquirk deleted the terra.fix_getdatasize_panic branch November 29, 2023 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wip Work In Progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0