go icon indicating copy to clipboard operation
go copied to clipboard

fatal error: sync: inconsistent mutex state

Open masihyeganeh opened this issue 5 years ago • 7 comments

Hello. I'm using version 1.1.7 and it crashes sometimes with mutex error.

Here is crash log:

fatal error: sync: inconsistent mutex state

goroutine 2058814 [running]:
runtime.throw(0x102ec51, 0x1e)
        /usr/local/go/src/runtime/panic.go:774 +0x72 fp=0xc01fd63fd0 sp=0xc01fd63fa0 pc=0x42e4f2
sync.throw(0x102ec51, 0x1e)
        /usr/local/go/src/runtime/panic.go:760 +0x35 fp=0xc01fd63ff0 sp=0xc01fd63fd0 pc=0x42e475
sync.(*Mutex).lockSlow(0x19fcdd8)
        /usr/local/go/src/sync/mutex.go:125 +0x1e9 fp=0xc01fd64038 sp=0xc01fd63ff0 pc=0x469999
sync.(*Mutex).Lock(...)
        /usr/local/go/src/sync/mutex.go:81
sync.(*Pool).pinSlow(0xc00022a0f0, 0x0, 0x0)
        /usr/local/go/src/sync/pool.go:213 +0x29d fp=0xc01fd640d8 sp=0xc01fd64038 pc=0x46a45d
sync.(*Pool).pin(0xc00022a0f0, 0x7fb3c9957380, 0x57)
        /usr/local/go/src/sync/pool.go:206 +0x5e fp=0xc01fd64100 sp=0xc01fd640d8 pc=0x46a18e
sync.(*Pool).Get(0xc00022a0f0, 0x40, 0x48)
        /usr/local/go/src/sync/pool.go:128 +0x2f fp=0xc01fd64148 sp=0xc01fd64100 pc=0x469e4f
github.com/json-iterator/go.(*frozenConfig).BorrowStream(0xc000161180, 0x0, 0x0, 0x413983)
        /usr/src/myapp/vendor/pkg/mod/github.com/json-iterator/[email protected]/pool.go:20 +0x36 fp=0xc01fd64170 sp=0xc01fd64148 pc=0xc6a8c6
github.com/json-iterator/go.(*frozenConfig).Marshal(0xc000161180, 0xf34b80, 0xc004761b30, 0x0, 0x0, 0x0, 0x0, 0x0)
        /usr/src/myapp/vendor/pkg/mod/github.com/json-iterator/[email protected]/config.go:297 +0x64 fp=0xc01fd64200 sp=0xc01fd64170 pc=0xc60764
…

Please let me know if you need more info to debug it.

Thanks

masihyeganeh avatar Jul 01 '20 08:07 masihyeganeh

Hi, can you put your test code here or on playground for us to reproduce the bug?

AllenX2018 avatar Jul 03 '20 07:07 AllenX2018

Looking to the stacktrace doubdfully it relates to json-iterator itself. Do you use trunk version of Go instead of stable releases?

funny-falcon avatar Jul 07 '20 13:07 funny-falcon

@funny-falcon No, I'm using stable version @AllenX2018 I'm trying to make a sample code to produce this situation. It is happening randomly in production under workload, and I couldn't make it throw exception outside of my project. Based on stacktrace it's like concurrency problem, but still couldn't reproduce it easily

masihyeganeh avatar Jul 07 '20 19:07 masihyeganeh

Same problem

vmpartner avatar Mar 09 '21 06:03 vmpartner

same problem

Valdenirmezadri avatar Mar 22 '21 12:03 Valdenirmezadri

did you solve the problem?

satyrswang avatar Nov 09 '22 08:11 satyrswang

did you solve the problem?

same problem

satyrswang avatar Nov 09 '22 08:11 satyrswang