Uploaded image for project: 'Commons Net'
  1. Commons Net
  2. NET-91

commons.net.FTPClient hangs on disconnect or logout

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.4
    • None
    • None
    • None
    • Operating System: All
      Platform: PC

    • 17066

    Description

      By repetitively calling

      try {

      // connect and login to the FTP server
      ftpc.connect(getPropertyFromEnv("FTP_SERVER"));

      ftpc.login(getPropertyFromEnv("USERNAME"), getPropertyFromEnv
      ("PASSWORD")); //technically we may have to break this into 2 blocks see
      examples

      // After connection attempt, check the reply code to verify success.
      reply = ftpc.getReplyCode();
      response = ftpc.getReplyString();

      if(!FTPReply.isPositiveCompletion(reply))

      { System.err.println("FTP server refused connection or login."); killFTP(ftpc); ftpc = null; }

      } catch(IOException e)

      { System.err.println("Can't connect or login to server, reply = "+reply+ " response = " + response); killFTP(ftpc); ftpc = null; }

      and then

      if (ftpc.isConnected()) {
      try

      { ftpc.logout(); }

      catch (Exception e)

      { // do nothing System.out.println("Exception in ftpc.logout()"); }

      try

      { ftpc.disconnect(); }

      catch (Exception e)

      { // do nothing System.out.println("Exception in ftpc.disconnect()"); }

      }

      one of the two bottom calls hangs and I'm assuming that it's in an infinite
      loop waiting for something that the server isn't sending. We try and hook to
      a Linux FTP server, and Windows FTP server and 99.99 % of the time it works,
      but every once in a while, it hangs and we have to kill the FTP daemon. After
      doing that everything works again!!!

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jmayo@sd.seabase.com Joe
              Votes:
              4 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: