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

lorenzodonini / ocpp-go
83%
master: 83%

Build:
Build:
LAST BUILD BRANCH: fix/mocks
DEFAULT BRANCH: master
Repo Added 24 May 2020 04:38PM UTC
Files 9
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

LAST BUILD ON BRANCH fix/ws-write-deadlock
branch: fix/ws-write-deadlock
CHANGE BRANCH
x
Reset
  • fix/ws-write-deadlock
  • 0.11.0
  • 1.6/improvements
  • 138-has-a-wrong-about-getdiagnosticsrequest-parameter
  • 150-logging-requestsresponses
  • 151-samplevalue-validation-value
  • 154-check-if-the-ocppj-client-is-connected
  • 160-csms-sim-hotfix
  • 160-error-defining-requeststarttransactionrequest
  • 161-chargingprofilestatus-notimplemented-should-be-notsupported
  • 168-fix-json-newline
  • 175-propertyconstraintviolation-configurationkey
  • 177-request-start-transaction-idtoken-validation
  • 188-v16-maxint
  • 194-setvariablestatus-wrong-type-validation
  • 200-validator-instance-seperate-in-ocpp16-and-ocpp201
  • 203-infinite-wait-on-stopping-a-disconnected-charge-point
  • 210-unhandled-formatviolation-type-on-callerror-on-ocpp-v2-ocpp-201-specification-table-b06fr17
  • 237-full-iso8601-support
  • 239-concurrent-chargers-example
  • 240-custom-message-hooks
  • 244-triggermessagereq-validation-disallows-passing-connector-0
  • 267-parses-an-ocpp-j-messageoccurrence-anomaly
  • 351-bug-panic-when-disconnecting-the-charger
  • bidirectional-ping
  • bugfix/88-config-key
  • bugfix/occurrence-constraint-violation
  • bugfix/ocpp-v2-subprotocol
  • bugfix/server-timeout
  • bugfix/validation-errors
  • bugfix/ws-existing-conn
  • chore/ci
  • chore/docs
  • chore/fix-test-ci
  • chore/fix-typo-2
  • chore/improve-err-handling
  • chore/ocpp-tests
  • chore/restructure-tests
  • chore/test-env
  • chore/tests
  • chore/update-codeowners
  • ci/improve-coveralls
  • ci/improvements
  • ci/lint
  • ci/test-improvements
  • concurrent-charge-point
  • custom-error-handling-hook
  • datetime-now-func
  • dependabot/github_actions/actions/checkout-4
  • dependabot/github_actions/actions/setup-go-5
  • dependabot/github_actions/docker/build-push-action-6
  • dependabot/github_actions/docker/login-action-3
  • dependabot/github_actions/docker/setup-buildx-action-3
  • dependabot/github_actions/docker/setup-qemu-action-3
  • dependabot/github_actions/jaxxstorm/action-install-gh-release-1.14.0
  • dependabot/github_actions/jaxxstorm/action-install-gh-release-2.0.0
  • dependabot/github_actions/jaxxstorm/action-install-gh-release-2.1.0
  • dependabot/go_modules/github.com/go-playground/universal-translator-0.18.1
  • dependabot/go_modules/github.com/gorilla/mux-1.8.1
  • dependabot/go_modules/github.com/gorilla/websocket-1.5.3
  • dependabot/go_modules/github.com/relvacode/iso8601-1.6.0
  • dependabot/go_modules/github.com/sirupsen/logrus-1.9.3
  • dependabot/go_modules/github.com/stretchr/testify-1.10.0
  • dependabot/go_modules/gopkg.in/go-playground/validator.v9-9.31.0
  • deprecated-errors-package
  • develop
  • disable-validation
  • docs/ocpp-manager
  • feat/benchmarks
  • feat/dispatcher-bench
  • feat/k6-gh-actions
  • feat/ocpp-2.1-support
  • feat/security-extension-tests
  • feat/websocket-compression
  • feature/authentication
  • feature/auto-reconnection
  • feature/build-cache
  • feature/github-actions
  • feature/observability
  • feature/observability-2
  • feature/ocpp-21
  • feature/pending-requests
  • feature/request-context
  • feature/websocket-config
  • feature/ws-cross-origin
  • fix-dependencies
  • fix-invalid-tls-client-test
  • fix/autogen
  • fix/callback-queue-tests
  • fix/concurrency
  • fix/connections
  • fix/event-bundle-nil-check
  • fix/example-config
  • fix/examples
  • fix/iso15118
  • fix/issue_templates
  • fix/mocks
  • fix/ocpp-201-composite.schedule
  • fix/ocpp-201-dialect
  • fix/ocpp201-schema-conformance
  • fix/profile-names
  • fix/state-locks
  • hotfix/cs-example-panic
  • hotfix/docker-tty
  • hotfix/example-cs-panic
  • hotfix/examples
  • hotfix/goveralls
  • hotfix/test-certificate-dns
  • issues/20-status-timestamp
  • maintenance/issue_templates
  • master
  • mocks-autogen
  • ocpp1.6/examples
  • ocpp16_config_manager
  • ocpp2.0-features
  • ocpp2.0.1-examples
  • ocpp2.0.1-rename
  • ocppj-reconnect-support
  • patch-1
  • prefer-new-connection-over-old-on-duplicate
  • refactor-ocppj-state
  • refactoring/dispatcher
  • refactoring/websocket-close
  • refs/tags/v0.14.0
  • refs/tags/v0.15.0
  • refs/tags/v0.16.0
  • refs/tags/v0.17.0
  • refs/tags/v0.18.0
  • refs/tags/v0.19.0
  • remove-errors-package
  • replace-errors-package
  • update-travis
  • v0.11.0
  • v0.12.0
  • v0.13.0
  • validator-upgrade
  • websocket-improvements
  • ws-verbose-logs
  • ws/close-connection-test
  • ws/connections-fix
  • ws/refactoring
  • ws/subprotocol

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

Relevant lines Covered
Build:
Build:
4504 RELEVANT LINES 3732 COVERED LINES
18.18 HITS PER LINE
Source Files on fix/ws-write-deadlock
  • Tree
  • List 54
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
24061322700 fix/ws-write-deadlock 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.RL... Pull #414 07 Apr 2026 02:32AM UTC shiv3 github
82.86
See All Builds (734)
  • Repo on GitHub
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