OpenHAB - Serial port write error

Hi guys

Sometimes I see some errors in the logs, I have no clue what the problem is.
I don’t find any logic in time or something else causing the errors.
Does anyone have any idea?

2019-04-30 21:11:15.022 [ERROR] [s.handler.VelbusNetworkBridgeHandler] - Serial port write error

java.net.SocketException: Socket closed

at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:118) ~[?:?]

at java.net.SocketOutputStream.write(SocketOutputStream.java:143) ~[?:?]

at org.openhab.binding.velbus.handler.VelbusNetworkBridgeHandler.writePacket(VelbusNetworkBridgeHandler.java:81) ~[?:?]

at org.openhab.binding.velbus.handler.VelbusBridgeHandler.sendPacket(VelbusBridgeHandler.java:126) ~[?:?]

at org.openhab.binding.velbus.handler.VelbusBridgeHandler.updateDate(VelbusBridgeHandler.java:90) ~[?:?]

at org.openhab.binding.velbus.handler.VelbusBridgeHandler.updateDateTime(VelbusBridgeHandler.java:74) ~[?:?]

at org.openhab.binding.velbus.handler.VelbusBridgeHandler.lambda$0(VelbusBridgeHandler.java:67) ~[?:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]

at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]

at java.lang.Thread.run(Thread.java:748) [?:?]

2019-04-30 21:11:15.160 [ERROR] [s.handler.VelbusNetworkBridgeHandler] - Serial port write error

java.net.SocketException: Socket closed

at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:118) ~[?:?]

at java.net.SocketOutputStream.write(SocketOutputStream.java:143) ~[?:?]

at org.openhab.binding.velbus.handler.VelbusNetworkBridgeHandler.writePacket(VelbusNetworkBridgeHandler.java:81) ~[?:?]

at org.openhab.binding.velbus.handler.VelbusBridgeHandler.sendPacket(VelbusBridgeHandler.java:126) ~[?:?]

at org.openhab.binding.velbus.handler.VelbusBridgeHandler.lambda$1(VelbusBridgeHandler.java:120) ~[?:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]

at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]

at java.lang.Thread.run(Thread.java:748) [?:?]

2019-04-30 21:13:53.366 [ERROR] [s.handler.VelbusNetworkBridgeHandler] - Serial port write error

java.net.SocketException: Socket closed

at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:118) ~[?:?]

at java.net.SocketOutputStream.write(SocketOutputStream.java:143) ~[?:?]

at org.openhab.binding.velbus.handler.VelbusNetworkBridgeHandler.writePacket(VelbusNetworkBridgeHandler.java:81) ~[?:?]

at org.openhab.binding.velbus.handler.VelbusBridgeHandler.sendPacket(VelbusBridgeHandler.java:126) ~[?:?]

at org.openhab.binding.velbus.handler.VelbusTemperatureSensorHandler.sendSensorReadoutRequest(VelbusTemperatureSensorHandler.java:103) ~[?:?]

at org.openhab.binding.velbus.handler.VelbusTemperatureSensorHandler.lambda$0(VelbusTemperatureSensorHandler.java:77) ~[?:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]

at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]

at java.lang.Thread.run(Thread.java:748) [?:?]

Greetings!

Hi

I’ve never seen this kind of thing.

@cedricb
Can you shine any light on this?

@CobleS
Which logs are those entries from?
I’ll take a closer look.

I access those logs with either “my-rpi-ip”:9001
Or when I PuTTy (is that Telnet?) to “my-rpi-ip”:22 , login and then use the command “openhab-cli showlogs”

Maybe some extra info: @MDAR has helped me a lot in these forum entries:
https://forum.velbus.eu/t/velbus-binding-for-openhab/14992/151
https://forum.velbus.eu/t/how-to-install-and-run-velserv-a-velbus-tcp-gateway/15422/2

1 Like

Kind of, you can use PuTTY in Telnet, Raw or SSH modes (and others)

I suspect you’re using it in SSH mode.
“Secure SHell”

I can confirm, it’s SSH I’m using

1 Like

That’s a new command, I’ll have to give that a try to find out which log it is showing you.

It could be either the event.log or openhab.log

Which you can see with these commands

tail -f /var/log/openhab2/openhab.log

tail -f /var/log/openhab2/events.log

ctrl & c to exit


It looks like

openhab-cli showlogs

Shows you the last 10 lines of openhab.log

Then monitors the events.log

@MDAR
I have no ID what “my-rpi-ip”:9001 shows, but when I compare that to the “openhab-cli showlogs”, to me it’s the same…
Interesting detail is that the 9001-version stays where you scroll the page, with the SSH-version it constantly flows
So both come handy

1 Like

Just a thought. :thought_balloon:

Now that you’ve resolved the issue with your Velbus Network Bridge, have these error messages stopped too ?

I was thinking the same…
At this moment I don’t see any errors, but as I said before, I couldn’t find any logic on why or when they appear. So, for now it’s ok.
If I see them again I’ll reply to this post :wink:

1 Like

@MDAR

I’ve left my log viewer open all day today, I’ve been watching it for 8 hours (not constantly offcourse :stuck_out_tongue: ).
And I’m happy to say that I haven’t seen a single error message like the ones I’ve posted here.
:crossed_fingers: let’s hope it stays like this. But I’ve got a good feeling about it…

Grtz!

Your girlfriend is such a lucky lady.

Seriously, I’m very happy to hear that the erroneous errors have stopped. :smile:

A “java.net.SocketException: Socket closed” exception can happen in various situations. Either the server side closed the connection like nKn suggested, or the client side (your app) closed the connection. Even if you are not aware of doing it, there may be some less obvious code that may lead to closing the socket, like Thread.interrupt() or ExecutorService.shutdownNow().

Check this … simple socket programming in java

@cedricb
@jeroends

Is this something that you guys have seen or can take a look at?

Hi, quincybatten1 is right, it looks like the network connection got interrupted somehow. Most likely the server isn’t listening anymore (e.g. a machine going into standby mode, restarting, …). A bad Wifi signal could also result in this kind of problems. Unfortunately the openHab velbus binding doesn’t restore connections once they fail, that will be something to improve in a next version.

1 Like