Uploaded image for project: 'FtpServer'
  1. FtpServer
  2. FTPSERVER-250

java.net.BindException: Address already in use

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0.0-RC1
    • 1.0.0-RC1
    • Core
    • None
    • linux, windows

    Description

      I have configured ftp server to use particular interface and port on active data mode like

      <active enabled="true" local-address="127.0.0.1" local-port="2020" ip-check="true"/>

      After that, the server starts to throw java.net.BindException: Address already in use during second and other data transfer. First data transfer is always ok. It seems that it has something to do with TIME_WAIT tcp port state (as it can be seen using netstat utility).

      I have created two tests, one for serial execution and one for parallel execution, see attached files (patch for ClientTestTemplate required)

      • serial execution - emulates what I'm doing in command line ftp client (or any other client), I'm always able to reproduce it on linux, but never on windows xp sp2
      • parallel execution - emulates situation when more then one data connection has to be opened in one time, it fails with two clients on linux (but it may by simple serial execution failure), on windows it fails with three clients

      BUT - I have tested the parallel test against proftpd server (fixed data port 20) with 30 clients and none of them fails.

      Are you able to reproduce the behaviour I have observed?

      Does anyone with deeper knowledge of java socket programming know if it is possible to bind a port once and then reuse it for generally unlimited number of (simultaneous) connections?

      Attachments

        1. ClientTestTemplate.patch
          2 kB
          Jiri Kuhn
        2. BindExceptionSerialTest.java
          1 kB
          Jiri Kuhn
        3. BindExceptionParallelTest.java
          3 kB
          Jiri Kuhn

        Activity

          People

            niklas Niklas Therning
            kuhn Jiri Kuhn
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: