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

DefaultSshFuture.awaitUninterruptibly() uses incorrect timeout

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.8.0
    • 0.9.0
    • None

    Description

      DefaultSshFuture.awaitInterruptibly() works by setting a timeout of Long.MAX_VALUE. When you add this to System.currentTimeMillis(), you get a time very much in the past, since the value wraps to the negatives.

      Later, to detect timeout, await0() does this upon being woken up:

      if (ready)

      { return true; }

      else {
      if (endTime < System.currentTimeMillis())

      { //THIS WILL ALWAYS BE TRUE return ready; }

      }

      Thus the ready check, which prevents spurious wakeups, never prevents spurious wakeups in the case that no timeout is specified.

      To fix this, endTime itself could simply be set to Long.MAX_VALUE rather than ADDING Long.MAX_VALUE to the current time.

      Attachments

        Activity

          People

            gnodet Guillaume Nodet
            markpeters Mark Peters
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: