Dear,
The listenerThread doesn't always exit when close is called causing __thread.join() to hang infinite.
I have a situation where an an exception occurs in send on self.__socket.sendall(data) (e.g. Broken pipe on a closed connection) and close is called afterwards to clean up the connection. Here close hangs forever on the join call for the listenerThread.
This because the listenerThread gets its own reference to the socket. When close sets self.__socket to None this is not seen by the listenerThread because its own reference still points to the original socket.
The read operation on the socket returns an empty bytestream so the listenerThread doesn't stop by itself.
Regards,
Bart
Hi, Thank you for pointing…
Hi,
Thank you for pointing this out. This is now fixed to version 2.0.15, and close now waits 5 seconds to get FIN from the server. If FIN is not received within that time, the connection is considered closed.
BR,
Mikko
Hello, The implemented fix…
Hello,
The implemented fix will avoid that the close call hangs, but it doesn't leave GXNet in a clean state. It will not be possible to reuse the connection and open it again.
Regards,
Bart
Hi, The client will send FIN…
Hi,
The client will send FIN to the server when the connection is closed. The meter will reply with ACK. It's not possible to reuse the connection after the client closes it. The client must establish the connection again.
BR,
Mikko
Hello, I understand. What I…
Hello,
I understand. What I mean is that the same instance of GXNet can not be used in such situations to open a new connection to the same device as it is not left in a clean state.
Regards,
Bart
Hi, The client side is…
Hi,
The client side is clean. The problem might be if the meter is not receiving FIN. In that case, you need to wait for a while before making a new connection.
BR,
Mikko