Skip to content

sync.Map report concurrent map read and map write #68364

@IcefireCgrbza

Description

@IcefireCgrbza

Go version

1.20.8

Output of go env in your module/workspace:

so sorry i cant provide much infomation, maybe sensitive

What did you do?

sorry i can't upload the complete code, my code invoke (sync.Map).Store method and report an error, read and write the sync.map is concurrent

 fatal error: concurrent map read and map write

goroutine 2480 [running]:
sync.(*Map).Swap(0xc015bafdd0, {0x984e080, 0xc013614a50}, {0x9ab49e0, 0xc01235ceb8})
 /usr/local/go/src/sync/map.go:353 +0x205
sync.(*Map).Store(...)
 /usr/local/go/src/sync/map.go:155
...

What did you see happen?

fatal error: concurrent map read and map write

goroutine 2480 [running]:
sync.(*Map).Swap(0xc015bafdd0, {0x984e080, 0xc013614a50}, {0x9ab49e0, 0xc01235ceb8})
/usr/local/go/src/sync/map.go:353 +0x205
sync.(*Map).Store(...)
/usr/local/go/src/sync/map.go:155
...

What did you expect to see?

how to fix it

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions