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

basic-station: concurrent write to websocket connection #191

Closed

Conversation

fancar
Copy link

@fancar fancar commented Apr 1, 2021

Hello Brocaar!
Recently I faced the issue. It happens when a gateway is under heavy load (~250-300 messages per min)

panic: concurrent write to websocket connection

goroutine 96544 [running]:
github.com/gorilla/websocket.(*messageWriter).flushFrame(0x2ab1724, 0x1, 0x0, 0x0, 0x0, 0xf14ee1ea, 0x52d33c)
/home/fancar/go/pkg/mod/github.com/gorilla/websocket@v1.4.2/conn.go:610 +0x590
github.com/gorilla/websocket.(*Conn).WriteMessage(0x28a69c0, 0x9, 0x0, 0x0, 0x0, 0x3b9aca00, 0x0)
/home/fancar/go/pkg/mod/github.com/gorilla/websocket@v1.4.2/conn.go:763 +0x1c8
github.com/brocaar/chirpstack-gateway-bridge/internal/backend/basicstation.(*Backend).websocketWrap.func2(0x2955340, 0x28a69c0, 0x28948c0, 0x2ab6340)
/home/fancar/dev/iot/chirp/chirpstack-gateway-bridge/internal/backend/basicstation/backend.go:833 +0x18c
created by github.com/brocaar/chirpstack-gateway-bridge/internal/backend/basicstation.(*Backend).websocketWrap
/home/fancar/dev/iot/chirp/chirpstack-gateway-bridge/internal/backend/basicstation/backend.go:827 +0x240

@fancar fancar closed this Apr 1, 2021
@brocaar
Copy link
Collaborator

brocaar commented Apr 6, 2021

Hi @fancar any reason why you closed the PR? Is it because your solution did not fix the issue, or is the issue no longer valid?

brocaar added a commit that referenced this pull request Apr 6, 2021
@brocaar
Copy link
Collaborator

brocaar commented Apr 6, 2021

@fancar I believe the above commit should fix the issue.

@fancar
Copy link
Author

fancar commented Apr 6, 2021

I closed it because It didn't pass the test. You can check the last commit in the same branch of fork tho. It works for me.
Thank you for your solution.

ps There is some memory leak problem I faced too. I'll send a new pull request as soon as I catch it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants