Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]: conn_map.go:66 panic concurrent map read and map write #525

Closed
3 tasks done
PotatoCloud opened this issue Jan 10, 2024 · 2 comments
Closed
3 tasks done
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@PotatoCloud
Copy link

Actions I've taken before I'm here

  • I've thoroughly read the documentations about this problem but still have no answer.
  • I've searched the Github Issues/Discussions but didn't find any similar problems that have been solved.
  • I've searched the internet for this problem but didn't find anything helpful.

Questions with details

when the number of connections is relatively high (like C50K), panic will occur.

fatal error: concurrent map read and map write

goroutine 12107 [running]:
github.com/panjf2000/gnet/v2.(*connMatrix).getConn(...)
        /Users/dev/go/pkg/mod/github.com/panjf2000/gnet/v2@v2.3.4/conn_map.go:66
github.com/panjf2000/gnet/v2.(*eventloop).close(0xc00097ca80, 0xc003f6b6c0, {0xba6040, 0xc002263980})
        /Users/dev/go/pkg/mod/github.com/panjf2000/gnet/v2@v2.3.4/eventloop_unix.go:174 +0xb3
github.com/panjf2000/gnet/v2.(*conn).write(0xc003f6b6c0, {0x0, 0x0, 0x0})
        /Users/dev/go/pkg/mod/github.com/panjf2000/gnet/v2@v2.3.4/connection_unix.go:137 +0x112
github.com/panjf2000/gnet/v2.(*conn).Write(0xbac128?, {0x0?, 0xc005330dd8?, 0x956b0f?})
        /Users/dev/go/pkg/mod/github.com/panjf2000/gnet/v2@v2.3.4/connection_unix.go:353 +0x4d
github.com/gobwas/ws.WriteFrame({0xba5ec0, 0xc0030f6a10}, {{0x1, 0x0, 0xa, 0x0, {0x0, 0x0, 0x0, 0x0}, ...}, ...})
        /Users/dev/go/pkg/mod/github.com/!real!fax/ws@v0.3.0/write.go:95 +0x50
github.com/gobwas/ws/wsutil.writeFrame({0xba5ec0?, 0xc0030f6a10?}, 0x78?, 0xf?, 0x33?, {0x0?, 0xc005330f78?, 0x409632?})
        /Users/dev/go/pkg/mod/github.com/!real!fax/ws@v0.3.0/wsutil/writer.go:570 +0x2f0
github.com/gobwas/ws/wsutil.WriteMessage(...)
        /Users/dev/go/pkg/mod/github.com/!real!fax/ws@v0.3.0/wsutil/helper.go:161
github.com/gobwas/ws/wsutil.WriteServerMessage(...)
        /Users/dev/go/pkg/mod/github.com/!real!fax/ws@v0.3.0/wsutil/helper.go:167
github.com/RealFax/peregrine.DefaultOnPingHandler(0xc004e61901?)
        /Users/dev/go/pkg/mod/github.com/!real!fax/peregrine@v0.6.1/handler.go:23 +0x37
github.com/RealFax/peregrine.(*Server).OnTraffic.func1()
        /Users/dev/go/pkg/mod/github.com/!real!fax/peregrine@v0.6.1/server.go:204 +0x1f
github.com/panjf2000/ants/v2.(*goWorker).run.func1()
        /Users/dev/go/pkg/mod/github.com/panjf2000/ants/v2@v2.9.0/worker.go:67 +0x8d
created by github.com/panjf2000/ants/v2.(*goWorker).run in goroutine 1160
        /Users/dev/go/pkg/mod/github.com/panjf2000/ants/v2@v2.9.0/worker.go:48 +0x5c

Code snippets (optional)

No response

@PotatoCloud PotatoCloud added help wanted Extra attention is needed question Further information is requested labels Jan 10, 2024
@panjf2000
Copy link
Owner

If you think you're running into a bug, please open an issue with the template of bug report and fill out all requested info.

@PotatoCloud
Copy link
Author

Sorry, it's my fault, I didn't use AsyncWrite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants