Closed evt closed 6 years ago
@evt thanks for the report (and sorry for not replying sooner--I just returned from some time off).
Do you have a way to reproduce the error by any chance?
@joshuap this provides a simple enough test case:
package main
import (
"fmt"
"sync"
"github.com/honeybadger-io/honeybadger-go"
)
func main() {
var (
wg sync.WaitGroup
context = honeybadger.Context{}
updateContext = honeybadger.Context{}
)
for i := 0; i < 1000000; i++ {
updateContext[fmt.Sprintf("%d", i)] = i
}
wg.Add(2)
go update(wg, context, updateContext)
go update(wg, context, updateContext)
wg.Wait()
}
func update(wg sync.WaitGroup, context honeybadger.Context, updateContext honeybadger.Context) {
context.Update(updateContext)
wg.Done()
}
Any chances of solving this? We are facing same error when running a high concurrency app 😢
@odarriba I'll take a look at it today.
@odarriba can you take a look at https://github.com/honeybadger-io/honeybadger-go/commit/1340b32ca4b7551867a7df97ee561e736689ddc0 (read the commit message for extra info) and tell me if it will solve this issue for you?
Greetings,
Looks like there is an issue with
type hash map[string]interface{}
used inMaps are not safe for concurrent use as per https://golang.org/doc/faq#atomic_maps and so we often face the following error:
Probably better replace with sync.Map or something like that.