DiamondLightSource / pmac

Driver for the Delta Tau PMAC motion controller family.
Apache License 2.0
25 stars 17 forks source link

Ensure socket is closed if error trying to establish SSH connection #67

Closed jgnrendra3 closed 6 years ago

jgnrendra3 commented 6 years ago

Added 3 missing calls to close() early in the the connectSSH() method. This appears to eliminate the too many open files errors caused by a growing number of open socket fds if the IOC cannot (re)connect to the controller.

gilesknap commented 6 years ago

Thanks for this Mark.

I've done some testing regarding reconnection and I also see that the ppmac does not reconnect successfully when the connection is restored. So this is different to the pmac. To be clear:-

  1. If the controller is not available at start-up I do not expect a reconnection to work. This is deliberately hobbled because the interdependencies of hardware specific classes makes it very hard to support this. Both pmac and ppmac exhibit this behaviour.
  2. If the controller is available at startup and then disconnects due to network disconnection or power cycle, then reconnection should work. For some reason this is not happening on ppmac.

(1) is not a major priority for me but could best be fixed by requiring that the startup script specifies which kind of controller you expect to connect to (instead of querying the controller on initial connection). I will look at doing this after I have added trajectory scanning to ppmac. (2) is a problem that will affect some of our beamlines and I will investigate this now.

Cheers, giles.