mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Peters (JIRA)" <j...@apache.org>
Subject [jira] [Created] (SSHD-219) DefaultSshFuture.awaitUninterruptibly() uses incorrect timeout
Date Tue, 12 Mar 2013 14:47:13 GMT
Mark Peters created SSHD-219:

             Summary: DefaultSshFuture.awaitUninterruptibly() uses incorrect timeout
                 Key: SSHD-219
                 URL: https://issues.apache.org/jira/browse/SSHD-219
             Project: MINA SSHD
          Issue Type: Bug
    Affects Versions: 0.8.0
            Reporter: Mark Peters

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.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message