Skip to content
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

Concurrent map writes when setting scope tags to event tags #30

Closed
SupaHam opened this issue Jun 13, 2022 · 1 comment · Fixed by #31
Closed

Concurrent map writes when setting scope tags to event tags #30

SupaHam opened this issue Jun 13, 2022 · 1 comment · Fixed by #31

Comments

@SupaHam
Copy link
Contributor

SupaHam commented Jun 13, 2022

When logging multiple events via zap in a small time frame, the event which zapsentry builds uses a shared map which causes the scope tag copying to apply concurrently and cause a fatal error.


goroutine 10638 [running]:
runtime.throw({0x27d98f6?, 0xffffffffffffffff?})
        /usr/local/go/src/runtime/panic.go:992 +0x71 fp=0xc00151b6a0 sp=0xc00151b670 pc=0x43f951
runtime.mapassign_faststr(0x24ae960, 0xc00086b710, {0x27b7fbc, 0x4})
        /usr/local/go/src/runtime/map_faststr.go:295 +0x406 fp=0xc00151b710 sp=0xc00151b6a0 pc=0x4176c6
github.com/getsentry/sentry-go.(*Scope).ApplyToEvent(0xc0001a6000, 0xc0000f0b40, 0x0)
        /home/supaham/go/pkg/mod/github.com/getsentry/[email protected]/scope.go:355 +0x1293 fp=0xc00151bb00 sp=0xc00151b710 pc=0x9f1853
github.com/getsentry/sentry-go.(*Client).prepareEvent(0xc0004ac160, 0xc0000f0b40, 0x0, {0x2c4dfc0, 0xc0001a6000})
        /home/supaham/go/pkg/mod/github.com/getsentry/[email protected]/client.go:604 +0xba3 fp=0xc00151cc40 sp=0xc00151bb00 pc=0x9e34e3
github.com/getsentry/sentry-go.(*Client).processEvent(0xc0004ac160, 0xc0000f0b40, 0x0, {0x2c4dfc0, 0xc0001a6000})
        /home/supaham/go/pkg/mod/github.com/getsentry/[email protected]/client.go:539 +0x49a fp=0xc00151d200 sp=0xc00151cc40 pc=0x9e22ba
github.com/getsentry/sentry-go.(*Client).CaptureEvent(0xc0004ac160, 0xc0000f0b40, 0x0, {0x2c4dfc0, 0xc0001a6000})
        /home/supaham/go/pkg/mod/github.com/getsentry/[email protected]/client.go:365 +0x54 fp=0xc00151d248 sp=0xc00151d200 pc=0x9e09f4
github.com/TheZeroSlave/zapsentry.(*core).Write(0xc000d86cd0, {0x2, {0xc0a1f0792157285e, 0xa0fd4bdfb, 0x3e68220}, {0x0, 0x0}, {0x27bb9ae, 0x7}, {0x1, ...}, ...}, ...)
        /home/supaham/go/pkg/mod/github.com/!the!zero!slave/[email protected]/core.go:104 +0x76c fp=0xc00151d878 sp=0xc00151d248 pc=0x12675ec
go.uber.org/zap/zapcore.(*CheckedEntry).Write(0xc0007c92c0, {0xc000fc2700, 0x2, 0x4})
        /home/supaham/go/pkg/mod/go.uber.org/[email protected]/zapcore/entry.go:220 +0x35c fp=0xc00151daf8 sp=0xc00151d878 pc=0x69c05c
go.uber.org/zap.(*SugaredLogger).log(0xc000010278, 0x2, {0x27bb9ae, 0x7}, {0x0, 0x0, 0x0}, {0xc003233e50, 0x4, 0x4})
        /home/supaham/go/pkg/mod/go.uber.org/[email protected]/sugar.go:227 +0x185 fp=0xc00151db88 sp=0xc00151daf8 pc=0x9320a5
go.uber.org/zap.(*SugaredLogger).Errorw(0xc000010278, {0x27bb9ae, 0x7}, {0xc0083e5e50, 0x4, 0x4})
        /home/supaham/go/pkg/mod/go.uber.org/[email protected]/sugar.go:191 +0x68 fp=0xc00151dbe8 sp=0xc00151db88 pc=0x931c08
@TheZeroSlave
Copy link
Owner

hi!
thanks for your PR. will surely look for it.

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

Successfully merging a pull request may close this issue.

2 participants