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

Question: level=error msg="client **** already exists, closing duplicate client" logger=websocket in loop #336

Open
2 of 5 tasks
rogeriocassares opened this issue Jan 21, 2025 · 4 comments

Comments

@rogeriocassares
Copy link

📜 Description

Hello @lorenzodonini !

This project is very great and inspires me from a long time ago.

Right now, I am trying to running behind a K8S Istio Ingress and having some troubles with WebsocketClient Connection. I am using a ABB/Keba charger. The problem is I cannot compreehnd what make the lot of connection with same Id, since i jyst have one Charging Station connected.

The local run command runs very ok. But when I run on K8S sometime it just flows, others is keeps the client disconnected only.

Basically the fork reads the MeterValues, StatusNotification, StartTransaction and StopTransaction and pu to MQTT.

Please, can you help me?

I I configure the EVSE to local running program it works, but in K8s, it does not.

Many Thanks!

👟 Reproduction steps

DockerImage: rogeriocassares/ocpp16-csms:0.13
Github: https://github.com/OpenDataTelemetry/ocpp16-csms

👍 Expected behavior

INFO[2025-01-21T18:16:10-03:00] new charge point connected client=BRIMTS01
INFO[2025-01-21T18:16:11-03:00] heartbeat handled client=BRIMTS01 message=Heartbeat
INFO[2025-01-21T18:16:11-03:00] received meter values for connector 0. Meter values: client=BRIMTS01 message=MeterValues
INFO[2025-01-21T18:16:11-03:00] {2025-01-21 21:16:10 +0000 UTC [{17752136.5 Sample.Clock Raw Energy.Active.Import.Register Outlet Wh}]} client=BRIMTS01 message=MeterValues

OnMeterValues: {"featureName": "MeterValues", "ConnectorId": "0", "chargePointId": "BRIMTS01", "forwardEnergy":17752136.5, "unit": "Wh", "format": "Raw", "measurand": "Energy.Active.Import.Register", "context": "Sample.Clock", "location": "Outlet", "deviceId": "BRIMTS01", "timestamp": 1737494171365365000}

INFO[2025-01-21T18:16:11-03:00] received meter values for connector 1. Meter values: client=BRIMTS01 message=MeterValues
INFO[2025-01-21T18:16:11-03:00] {2025-01-21 21:16:10 +0000 UTC [{2914749.9 Sample.Clock Raw Energy.Active.Import.Register Outlet Wh}]} client=BRIMTS01 message=MeterValues

👎 Actual Behavior

The errors are bellow:

time="2025-01-21T21:02:42Z" level=info msg="new charge point connected" client=BRIMTS01
time="2025-01-21T21:02:42Z" level=info msg="boot confirmed" client=BRIMTS01 message=BootNotification
time="2025-01-21T21:02:43Z" level=error msg="client BRIMTS01 already exists, closing duplicate client" logger=websocket
time="2025-01-21T21:02:43Z" level=error msg="client BRIMTS01 already exists, closing duplicate client" logger=websocket
time="2025-01-21T21:02:43Z" level=error msg="client BRIMTS01 already exists, closing duplicate client" logger=websocket
time="2025-01-21T21:03:42Z" level=info msg="closed connection to BRIMTS01" logger=websocket
time="2025-01-21T21:03:42Z" level=info msg="charge point disconnected" client=BRIMTS01
time="2025-01-21T21:04:47Z" level=info msg="new charge point connected" client=BRIMTS01
time="2025-01-21T21:04:48Z" level=error msg="client BRIMTS01 already exists, closing duplicate client" logger=websocket
time="2025-01-21T21:05:47Z" level=info msg="closed connection to BRIMTS01" logger=websocket
time="2025-01-21T21:05:47Z" level=info msg="charge point disconnected" client=BRIMTS01
time="2025-01-21T21:06:49Z" level=info msg="new charge point connected" client=BRIMTS01
time="2025-01-21T21:06:52Z" level=error msg="client BRIMTS01 already exists, closing duplicate client" logger=websocket

What OCPP version are you using?

  • OCPP 1.6
  • OCPP 2.0.1

Are you using any OCPP extensions?

  • OCPP 1.6 Security
  • OCPP 1.6 Plug and Charge

release version

v0.18.0

📃 Provide any additional context for the Bug.

No response

👀 Have you spent some time to check if this bug has been found before?

  • I checked and didn't find a similar issue
@rogeriocassares rogeriocassares changed the title 🐛 Bug: 🐛 Bug: level=error msg="client **** already exists, closing duplicate client" logger=websocket in loop Jan 21, 2025
@xBlaz3kx
Copy link
Contributor

xBlaz3kx commented Jan 21, 2025

This sounds unrelated to the library itself, since you tried it running locally and it worked fine. Check your K8s networking configuration and how Istio handles websockets.

Or you can also try to decrease/disable websocket ping point to keep the client connected. The issue is if the client (charge point) reconnects too fast, the central system will not register the disconnect and will think the charge point is still connected and the central system wont allow duplicate connections.

@rogeriocassares
Copy link
Author

Hi @xBlaz3kx !

Good idea! I was stuck. What the timeout the central system register a new connection?

@xBlaz3kx
Copy link
Contributor

You can set Websocket server settings via this configuration:

// Config contains optional configuration parameters for a websocket client.
// Setting the parameter allows to define custom timeout intervals for websocket network operations.
//
// To set a custom configuration, refer to the client's SetTimeoutConfig method.
// If no configuration is passed, a default configuration is generated via the NewClientTimeoutConfig function.
type ClientTimeoutConfig struct {
	WriteWait               time.Duration
	HandshakeTimeout        time.Duration
	PongWait                time.Duration
	PingPeriod              time.Duration
	RetryBackOffRepeatTimes int
	RetryBackOffRandomRange int
	RetryBackOffWaitMinimum time.Duration
}

in this file

@rogeriocassares
Copy link
Author

Hey @xBlaz3kx ! Thanks for the light! The EVSE was set to 60s.

I disabled the PingPong from EVSE, then I set to 300s.

I will make more testes and post the results here.

YES! MANY THANKS!

@rogeriocassares rogeriocassares changed the title 🐛 Bug: level=error msg="client **** already exists, closing duplicate client" logger=websocket in loop Question: level=error msg="client **** already exists, closing duplicate client" logger=websocket in loop Jan 21, 2025
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

No branches or pull requests

2 participants