From e07838bb8ea97b98238403aceeff022d6cc6a4ca Mon Sep 17 00:00:00 2001 From: andig Date: Tue, 12 May 2026 13:39:23 +0200 Subject: [PATCH] OCPP: dispatch RemoteStartTransaction asynchronously to avoid WebSocket deadlock (#29838) --- charger/ocpp/connector_core.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/charger/ocpp/connector_core.go b/charger/ocpp/connector_core.go index 935916257..a780357e6 100644 --- a/charger/ocpp/connector_core.go +++ b/charger/ocpp/connector_core.go @@ -39,7 +39,15 @@ func (conn *Connector) OnStatusNotification(request *core.StatusNotificationRequ if conn.isWaitingForAuth() { if conn.remoteIdTag != "" { - conn.RemoteStartTransactionRequest(conn.remoteIdTag) + // dispatch asynchronously: RemoteStartTransactionRequest issues a + // synchronous CS→CP request whose response is read by this same + // goroutine, so a blocking call would deadlock the WebSocket read + // loop (cf. ocpp_test_handler.go). + go func(idTag string) { + if err := conn.RemoteStartTransactionRequest(idTag); err != nil { + conn.log.ERROR.Printf("RemoteStartTransaction: %v", err) + } + }(conn.remoteIdTag) } else { conn.log.DEBUG.Printf("waiting for local authentication") }