Skip to main content
Home
for DLMS smart meters

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. GXNet Python Implementation Hangs On Close

GXNet python implementation hangs on close

By Tooling_Xemex, 12 May, 2025
Forums
Gurux.Net

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

Profile picture for user Kurumi

Kurumi

1 month 1 week ago

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

Tooling_Xemex

1 month 1 week ago

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

Profile picture for user Kurumi

Kurumi

1 month 1 week ago

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

Tooling_Xemex

1 month 1 week ago

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

Profile picture for user Kurumi

Kurumi

1 month 1 week ago

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

  • Log in or register to post comments
  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Thu, 06/19/2025 - 09:33
    Gurux.DLMS.Python 1.0.185
  • Wed, 06/18/2025 - 15:11
    Gurux.DLMS.Python 1.0.184
  • Wed, 06/18/2025 - 10:05
    Gurux.DLMS.Python 1.0.183
  • Wed, 06/18/2025 - 09:06
    GXDLMSDirector 9.0.2506.1801
  • Wed, 06/18/2025 - 08:41
    Gurux.DLMS.Net 9.0.2506.1801

New forum topics

  • object list not get downloaded for firmware upgrade association
  • HLS GMAC L+G 570
  • Unable to read parameter values from Landis+Gyr E550 meter using GXDLMSDirector - NoAccess status
  • data.SetComplete(false); But all data recieved
  • Crash (endless loop)
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin