asterics / AsTeRICS

The Assistive Technology Rapid Integration & Construction Set
http://www.asterics.eu
Other
57 stars 27 forks source link

IrTrans.readFromSocket endless SocketException #191

Closed deinhofer closed 7 years ago

deinhofer commented 7 years ago

Tested with Asterics Ergo 3.3.0:

Start Asterics Ergo with a connected IrTrans device. If you then close the IrTransServer program an endless SocketException occurs:

While this is clear because closing IrTransServer closes the socket it should not endlessly try to read from it in an endless loop without sleep in between.

Okt 23, 2017 10:07:07 PM eu.asterics.component.actuator.irtrans.IrTransInstance$1 run
INFORMATION: IRTrans received: ERROR_SOCKET_NOT_OPEN
Okt 23, 2017 10:07:07 PM eu.asterics.component.actuator.irtrans.IrTransInstance readFromSocket
WARNUNG: exception reading from tcpSocket
java.net.SocketException: Socket is closed
        at java.net.Socket.setSoTimeout(Unknown Source)
        at eu.asterics.component.actuator.irtrans.IrTransInstance.readFromSocket(IrTransInstance.java:357)
        at eu.asterics.component.actuator.irtrans.IrTransInstance.access$600(IrTransInstance.java:52)
        at eu.asterics.component.actuator.irtrans.IrTransInstance$1.run(IrTransInstance.java:304)
        at java.lang.Thread.run(Unknown Source)

Okt 23, 2017 10:07:07 PM eu.asterics.component.actuator.irtrans.IrTransInstance$1 run
INFORMATION: IRTrans received: ERROR_SOCKET_NOT_OPEN
Okt 23, 2017 10:07:07 PM eu.asterics.component.actuator.irtrans.IrTransInstance readFromSocket
WARNUNG: exception reading from tcpSocket
java.net.SocketException: Socket is closed
        at java.net.Socket.setSoTimeout(Unknown Source)
        at eu.asterics.component.actuator.irtrans.IrTransInstance.readFromSocket(IrTransInstance.java:357)
        at eu.asterics.component.actuator.irtrans.IrTransInstance.access$600(IrTransInstance.java:52)
        at eu.asterics.component.actuator.irtrans.IrTransInstance$1.run(IrTransInstance.java:304)
        at java.lang.Thread.run(Unknown Source)

Okt 23, 2017 10:07:07 PM eu.asterics.component.actuator.irtrans.IrTransInstance$1 run
INFORMATION: IRTrans received: ERROR_SOCKET_NOT_OPEN
Okt 23, 2017 10:07:07 PM eu.asterics.component.actuator.irtrans.IrTransInstance readFromSocket
WARNUNG: exception reading from tcpSocket
java.net.SocketException: Socket is closed
        at java.net.Socket.setSoTimeout(Unknown Source)
        at eu.asterics.component.actuator.irtrans.IrTransInstance.readFromSocket(IrTransInstance.java:357)
        at eu.asterics.component.actuator.irtrans.IrTransInstance.access$600(IrTransInstance.java:52)
        at eu.asterics.component.actuator.irtrans.IrTransInstance$1.run(IrTransInstance.java:304)
        at java.lang.Thread.run(Unknown Source)

Okt 23, 2017 10:07:07 PM eu.asterics.component.actuator.irtrans.IrTransInstance$1 run
INFORMATION: IRTrans received: ERROR_SOCKET_NOT_OPEN
Okt 23, 2017 10:07:07 PM eu.asterics.component.actuator.irtrans.IrTransInstance readFromSocket
WARNUNG: exception reading from tcpSocket
java.net.SocketException: Socket is closed
        at java.net.Socket.setSoTimeout(Unknown Source)
        at eu.asterics.component.actuator.irtrans.IrTransInstance.readFromSocket(IrTransInstance.java:357)
        at eu.asterics.component.actuator.irtrans.IrTransInstance.access$600(IrTransInstance.java:52)
        at eu.asterics.component.actuator.irtrans.IrTransInstance$1.run(IrTransInstance.java:304)
        at java.lang.Thread.run(Unknown Source)

Okt 23, 2017 10:07:07 PM eu.asterics.component.actuator.irtrans.IrTransInstance$1 run
INFORMATION: IRTrans received: ERROR_SOCKET_NOT_OPEN
Okt 23, 2017 10:07:07 PM eu.asterics.component.actuator.irtrans.IrTransInstance readFromSocket
WARNUNG: exception reading from tcpSocket
java.net.SocketException: Socket is closed
        at java.net.Socket.setSoTimeout(Unknown Source)
        at eu.asterics.component.actuator.irtrans.IrTransInstance.readFromSocket(IrTransInstance.java:357)
        at eu.asterics.component.actuator.irtrans.IrTransInstance.access$600(IrTransInstance.java:52)
        at eu.asterics.component.actuator.irtrans.IrTransInstance$1.run(IrTransInstance.java:304)
        at java.lang.Thread.run(Unknown Source)

Okt 23, 2017 10:07:07 PM eu.asterics.component.actuator.irtrans.IrTransInstance$1 run
INFORMATION: IRTrans received: ERROR_SOCKET_NOT_OPEN
Okt 23, 2017 10:07:07 PM eu.asterics.component.actuator.irtrans.IrTransInstance readFromSocket
WARNUNG: exception reading from tcpSocket
java.net.SocketException: Socket is closed
        at java.net.Socket.setSoTimeout(Unknown Source)
        at eu.asterics.component.actuator.irtrans.IrTransInstance.readFromSocket(IrTransInstance.java:357)
        at eu.asterics.component.actuator.irtrans.IrTransInstance.access$600(IrTransInstance.java:52)
        at eu.asterics.component.actuator.irtrans.IrTransInstance$1.run(IrTransInstance.java:304)
        at java.lang.Thread.run(Unknown Source)

Okt 23, 2017 10:07:07 PM eu.asterics.component.actuator.irtrans.IrTransInstance$1 run
INFORMATION: IRTrans received: ERROR_SOCKET_NOT_OPEN
Okt 23, 2017 10:07:07 PM eu.asterics.component.actuator.irtrans.IrTransInstance readFromSocket
WARNUNG: exception reading from tcpSocket
java.net.SocketException: Socket is closed
        at java.net.Socket.setSoTimeout(Unknown Source)
        at eu.asterics.component.actuator.irtrans.IrTransInstance.readFromSocket(IrTransInstance.java:357)
        at eu.asterics.component.actuator.irtrans.IrTransInstance.access$600(IrTransInstance.java:52)
        at eu.asterics.component.actuator.irtrans.IrTransInstance$1.run(IrTransInstance.java:304)
        at java.lang.Thread.run(Unknown Source)
klues commented 7 years ago

fixed with https://github.com/asterics/AsTeRICS/pull/192 With this the readerThread is interrupted, if a socketException occurs (e.g. IrTrans server is closed) and the endless exceptions are stopped. However I did not implement any automatic re-open attempts if IrTrans server is started again. I think this is not the most important thing, especially if you keep in mind that we even do not know if anyone uses this feature of IrTrans right now. (But AsTeRICS-Ergo works after re-opening IrTrans server, thats the important thing for us :))

So to my mind the issue is fixed and I'll close it.