You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Guillaume Nodet (JIRA)" <ji...@apache.org> on 2013/07/18 09:50:48 UTC
[jira] [Resolved] (SSHD-219)
DefaultSshFuture.awaitUninterruptibly() uses incorrect timeout
[ https://issues.apache.org/jira/browse/SSHD-219?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Guillaume Nodet resolved SSHD-219.
----------------------------------
Resolution: Fixed
Fix Version/s: 0.9.0
Assignee: Guillaume Nodet
> 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
> Assignee: Guillaume Nodet
> Fix For: 0.9.0
>
>
> 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