Backend Crashing and Restarting - [socket.AbstractWebsocketServer] [Edge.Websocket] OnInternalError for EdgeWebsocket.WsData [edgeId=edge0]. class java.lang.NullPointerException: null

Hello,

I am setting up a deployment of OpenEMS within AWS EC2.

I have built the Edge and Backend JARs according to the instructions and have deployed these on EC2 instances.

My edge unit seems to be working correctly, however I am experiencing a large number of errors and crashes on my backend, which appear to be related to the Edge Websocket connection (which I have not yet managed to get working correctly).

I have attempted to configure the edge and backend according to the instructions in the Getting Started guide. I have been unable to make a stable connection and it seems like the backend service is crashing and restarting.

When I run systemctl status openems I see many messages such as this:

Feb 27 13:41:50 ip-172-30-2-87 systemd[1]: openems.service: Scheduled restart job, restart counter is at 3349.
Feb 27 13:41:50 ip-172-30-2-87 systemd[1]: Stopped OpenEMS Edge.
Feb 27 13:41:50 ip-172-30-2-87 systemd[1]: openems.service: Consumed 4.830s CPU time.
Feb 27 13:41:50 ip-172-30-2-87 systemd[1]: Starting OpenEMS Edge...

The restart counter is at 3349, implying that the software has crashed and restarted many times.

When I inspect the logs, I see many mesages like this one, repeating on each tick of the controller cycle.

2023-02-27T13:29:53,719 [socket-1] ERROR [socket.AbstractWebsocketServer] [Edge.Websocket] OnInternalError for EdgeWebsocket.WsData [edgeId=edge0]. class java.lang.NullPointerException: null
java.lang.NullPointerException
        at io.openems.backend.uiwebsocket.impl.UiWebsocketImpl.sendSubscribedChannels(UiWebsocketImpl.java:211)
        at io.openems.backend.edgewebsocket.OnNotification.handleTimestampedDataNotification(OnNotification.java:125)
        at io.openems.backend.edgewebsocket.OnNotification.run(OnNotification.java:58)
        at io.openems.common.websocket.OnNotificationHandler.run(OnNotificationHandler.java:22)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)

I am also unable to load the Apache Felix Web Console for the backend much of the time, also implying that the system is restarting and suffering from downtime.

I am unsure where I have gone wrong with this as I have been configuring the backend as per the Getting Started guide.

Has anyone else encountered this (or similar) issues before?

Thanks,
Thomas

Hi Thomas,

Thanks for the detailed error description. I suspect those might be two different problems, because even the NullPointerException should not cause the backend service to crash.

Can you please check/provide the following information?

  1. Does your systemd service file for Backend look exactly like this? → Deploy OpenEMS Backend :: Open Energy Management System. Specificially I am asking for the Type=simple property. If this is set to Type=notify (like in the OpenEMS Edge documentation), it will cause systemd to restart the service.

  2. Ports: I suspect you might be connecting the Edge (Controller Api Backend) with the Backend UI.Websocket. Please check:
    2.1. Which port did you configure in Edge.Websocket and UI.Websocket (Getting Started :: Open Energy Management System)
    2.2. Which port did you configure in Controller Api Backend (Getting Started :: Open Energy Management System)
    2.3. Which command are you using to run the UI against the backend? (Getting Started :: Open Energy Management System).
    2.4. Do you use a (NGINX-)Proxy for the ports? (You should do that for production use to enable TLS encryption)

Regards,
Stefan

Thank you for the information Stefan. I think the issue was actually something separate which was that I was running on a device with limited storage space and was not rotating the log files which was causing a lot of crashes.