Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-20073

Unhandled exception in SSH session leaves connection hanging

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low
    • None
    • 8.9.19, 9.6.2, 8.19.19, 9.4.7
    • SSH
    • None

      Issue Summary

      Uncaught exceptions in the SSH server are not handled correctly, leaving connections hanging.

      Steps to Reproduce

      Cause an uncaught exception during SSH session. 

      Expected Results

      Any exception that ends request processing should also terminate the connection to prevent memory leaks in the server, and notify the client.

      Actual Results

      An uncaught runtime exception thrown inside the SSH server code bubbles up to the `SshCommandAdapter` and stops all request processing, but does not close the connection. The connection remains open until the idle timeout kills it, after 2 hours. The clients sits waiting without any response.

      Exception in thread "ssh:thread-1" java.lang.RuntimeException
      ...
      at com.atlassian.bitbucket.internal.ssh.server.SshCommandAdapter$SshCommandRunnable.run(SshCommandAdapter.java:332)
          at com.atlassian.bitbucket.internal.ssh.utils.NamePreservingRunnable.run(NamePreservingRunnable.java:30)
          at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
          at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
          at java.base/java.lang.Thread.run(Thread.java:840) 

      Workaround

      Currently there is no known workaround for this behavior. A workaround will be added here when available

              Unassigned Unassigned
              01bcfab7c8bf Tom Daffurn
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: