-
Notifications
You must be signed in to change notification settings - Fork 243
Closed
Labels
BugIssue typeIssue type
Description
Summary
When span.Finish is called, there's a chance a fatal concurrent write could occur due to the forceful setting of device parameters arch and cpu.
Steps To Reproduce
- Set "device" context on scope concurrently using
scope.SetContext - In parallel, create and Finish a span as is.
fatal error: concurrent map writes
scope.SetContext("device", map[string]interface{}{
"name": model
})Expected Behavior
Don't crash the go application because integrations have no concept of context safety.
Screenshots
Sentry.io Event
Environment
SDK
sentry-goversion: v0.16.0- Go version: 1.18
- Using Go Modules? yes
Sentry
- Using hosted Sentry in sentry.io? yes
- Using your own Sentry installation? Version:
- Anything particular to your environment that could be related to this issue?
Additional context
goroutine 140293796 [running]:
runtime.throw({0x2935f76?, 0x24b8a60?})
/usr/local/go/src/runtime/panic.go:992 +0x71 fp=0xc01795ddc0 sp=0xc01795dd90 pc=0x43bcb1
runtime.mapassign_faststr(0x24b8640, 0xc0297caff0, {0x2909cb4, 0x4})
/usr/local/go/src/runtime/map_faststr.go:295 +0x38b fp=0xc01795de28 sp=0xc01795ddc0 pc=0x416acb
github.com/getsentry/sentry-go.(*environmentIntegration).processor(0x0?, 0xc009852a00, 0xc01795dd38?)
/build/.go/pkg/mod/github.com/getsentry/[email protected]/integrations.go:89 +0x21a fp=0xc01795ded0 sp=0xc01795de28 pc=0x8d62ba
github.com/getsentry/sentry-go.(*environmentIntegration).processor-fm(0xc006d61560?, 0xc009852a00?)
<autogenerated>:1 +0x2f fp=0xc01795def8 sp=0xc01795ded0 pc=0x8e5b6f
github.com/getsentry/sentry-go.(*Client).prepareEvent(0xc000d6e000, 0xc009852a00, 0x0?, {0x30983c0, 0xc006d61560})
/build/.go/pkg/mod/github.com/getsentry/[email protected]/client.go:642 +0x6a3 fp=0xc01795ecf0 sp=0xc01795def8 pc=0x8d2683
github.com/getsentry/sentry-go.(*Client).processEvent(0xc000d6e000, 0xc009852a00, 0x0, {0x30983c0, 0xc006d61560})
/build/.go/pkg/mod/github.com/getsentry/[email protected]/client.go:569 +0x185 fp=0xc01795eff8 sp=0xc01795ecf0 pc=0x8d1d85
github.com/getsentry/sentry-go.(*Client).CaptureEvent(...)
/build/.go/pkg/mod/github.com/getsentry/[email protected]/client.go:395
github.com/getsentry/sentry-go.(*Hub).CaptureEvent(0xc0255b39b0, 0xc009852a00)
/build/.go/pkg/mod/github.com/getsentry/[email protected]/hub.go:224 +0x66 fp=0xc01795f040 sp=0xc01795eff8 pc=0x8d5146
github.com/getsentry/sentry-go.(*Span).Finish(0xc000e4fb20)
/build/.go/pkg/mod/github.com/getsentry/[email protected]/tracing.go:185 +0x174 fp=0xc01795f0a0 sp=0xc01795f040 pc=0x8defb4
...
This issue has been around for around at least a year. This environment is a game server that gains a lot of unique connections and requires has multiple goroutines running at the initialisation of the connection that are spawning spans, while asynchronously manipulating context as new data comes in.
Metadata
Metadata
Assignees
Labels
BugIssue typeIssue type