sshlib icon indicating copy to clipboard operation
sshlib copied to clipboard

Connection.openSession can create a deadlock situation

Open daniel-trang opened this issue 4 years ago • 0 comments

Scenario:

  • Create a Connection and connect it to a linux machine.
  • Authenticate user/connection.
  • Drop the network connection (ex: disable network card on linux machine)
  • Try to open a session using connection.openSession(), this method will waitUntilChannelOpen
  • Despite restoring the network connection, waitUntilChannelOpen does not return.
  • The only way to notify waitUntilChannelOpen to wake it up is by closing the channel it is waiting on.
  • Connection.close is the only way to close the channel but it cannot be called because it is also synchronized and the previous call to openSession currently holds the monitor lock on the connection object. Consequently, there is no way to abort the hung openSession call or close the connection.

daniel-trang avatar Mar 26 '21 10:03 daniel-trang