gnet
gnet copied to clipboard
[Bug]: concurrent map write and read
Actions I've taken before I'm here
- [X] I've thoroughly read the documentations on this issue but still have no clue.
- [X] I've searched the Github Issues but didn't find any duplicate issues that have been resolved.
- [X] I've searched the internet for this issue but didn't find anything helpful.
What happened?
I have encounter panic
fatal error: concurrent map read and map write
when using this.
Major version of gnet
v2
Specific version of gnet
v2.5.7
Operating system
Linux
OS version
Ubuntu 20.04
Go version
go1.21
Relevant log output
fatal error: concurrent map read and map write
goroutine 77 [running, locked to thread]:
github.com/panjf2000/gnet/v2.(*connMatrix).getConn(...)
/github.com/panjf2000/gnet/[email protected]/conn_map.go:66
github.com/panjf2000/gnet/v2.(*eventloop).close(0xc00080ab00, 0xc009306d20, {0x23ffc80, 0xc00b44c440})
/github.com/panjf2000/gnet/[email protected]/eventloop_unix.go:230 +0x70
github.com/panjf2000/gnet/v2.(*eventloop).read(0xc00080ab00, 0xc009306d20)
/github.com/panjf2000/gnet/[email protected]/eventloop_unix.go:139 +0x310
github.com/panjf2000/gnet/v2.(*conn).processIO(0xc009306d20, 0xc00087d650?, 0x19, 0x0?)
/github.com/panjf2000/gnet/[email protected]/connection_linux.go:54 +0xa5
github.com/panjf2000/gnet/v2.(*eventloop).orbit.func1(0x1af, 0x19, 0x0)
/github.com/panjf2000/gnet/[email protected]/reactor_default.go:66 +0x1b6
github.com/panjf2000/gnet/v2/internal/netpoll.(*Poller).Polling(0xc000c837a0, 0xc00177df28)
/github.com/panjf2000/gnet/[email protected]/internal/netpoll/poller_epoll_default.go:136 +0x26c
github.com/panjf2000/gnet/v2.(*eventloop).orbit(0xc00080ab00)
/github.com/panjf2000/gnet/[email protected]/reactor_default.go:54 +0x97
Code snippets (optional)
No response
How to Reproduce
Steps to reproduce the behavior: This behavior only occur by chance, there is no reproduce steps. As long as its is running with multi thread there will be chance for this panic to occur.
Does this issue reproduce with the latest release?
It can reproduce with the latest release