Uploaded image for project: 'MINA SSHD'
  1. MINA SSHD
  2. SSHD-877

org.apache.sshd.common.io.nio2.Nio2Acceptor#bind failed cause file descriptor leak

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.7.0
    • 2.2.0
    • None
    • java: 1.8
      os: centos7
      ssh client: xshell 5

    Description

      When the binding fails in org.apache.sshd.common.io.nio2.Nio2Acceptor#bind, the file descriptor will be leaked.

      Possible reasons:

      When AsynchronousServerSocketChannel#bind bind a port that has already been listened to, the code will throw a BindException, but the code does not handle the exception, causing the socket to have no chance to be closed. Eventually results in a limit on the number of maximum file descriptors that exceed the system.

       

      Compile Main.java and run it on a linux machine.

      Use the client to connect to the server and the client to set up x11 forwarding. Using lsof on the machine where the server is located, you can see the file descriptors that have not been released.

      Attachments

        1. Main.java
          1 kB
          Zhenliang Su
        2. nio2acceptor.png
          34 kB
          Zhenliang Su

        Activity

          People

            lgoldstein Lyor Goldstein
            suzl Zhenliang Su
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: