• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lorenzodonini / ocpp-go / 24061322700
83%
master: 83%

Build:
Build:
LAST BUILD BRANCH: fix/ws-write-deadlock
DEFAULT BRANCH: master
Ran 07 Apr 2026 02:32AM UTC
Jobs 1
Files 54
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

07 Apr 2026 02:29AM UTC coverage: 82.86% (+0.04%) from 82.818%
24061322700

Pull #414

github

shiv3
fix: prevent deadlock in websocket write during connection cleanup

When many connections disconnect simultaneously (e.g. cluster autoscaler
pod restart), a deadlock can occur between WriteManual/Close and cleanup:

1. WriteManual holds w.mutex.RLock and blocks on outQueue send (buffer full,
   writePump no longer reading because it exited to call cleanup)
2. cleanup waits for w.mutex.Lock, which requires all RLock holders to release
3. Neither can proceed -> deadlock

Additionally, server.Write held s.connMutex.RLock during the entire w.Write
call. If w.Write blocked, it prevented all handleDisconnect calls (which need
s.connMutex.Lock) across all connections, causing cascading "already exists"
errors when charge points attempted to reconnect.

Fix:
- Add a done channel to webSocket, closed at the start of cleanup
- Use select in WriteManual and Close to abort when done is signaled
- Release s.connMutex.RLock in server.Write before calling w.Write
Pull Request #414: fix: prevent deadlock in websocket write during connection cleanup

12 of 16 new or added lines in 2 files covered. (75.0%)

3732 of 4504 relevant lines covered (82.86%)

18.18 hits per line

Uncovered Changes

Lines Coverage ∆ File
4
85.33
0.56% ws/websocket.go
Jobs
ID Job ID Ran Files Coverage
1 24061322700.1 07 Apr 2026 02:32AM UTC 54
82.86
GitHub Action Run
Source Files on build 24061322700
  • Tree
  • List 54
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Pull Request #414
  • PR Base - master (#17022091823)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc