basic-station: concurrent write to websocket connection #191
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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