Skip to content

Draft: Set up keepalive on ieee488_2 transport

Problem

During our usage of QBlox equipment, we experienced a problem of socket closing after approximately 10 minutes of inactivity. The only way to restore the setup in this case was reinitialization of an instrument in some way.

The source of the problem may or may not be the dockerized environment we are using, we were not able to track it down.

Proposed solution

No matter what network layers are used for the access to the equipment, setting up keepalive signals would be beneficial for every connection that should persist no matter what. In this MR we have set up keepalives on a socket that was causing problems using code snippet from [1], that is supposed to be cross-platform.

According to our internal testing, this solution resolves the issue.

Points to be aware

  • I think that this setting sends keepalives quite aggressively. Since the setup dies after approx 10 min of standby, keepalive period of 60 sec should be enough.
  • I would check other sockets QBlox drivers are using and set keepalives also there. I assume this does not cause much load, but increases reliability of the network connections.
  • Keepalive ping-pong can also be used to monitor the connectivity and raise a user-friendly exception if network connection is lost.

References

[1] https://github.com/StorjOld/pyp2p/blob/7024208c3af20511496a652ff212f54c420e0464/pyp2p/sock.py

Edited by Viacheslav Ostroukh

Merge request reports