You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Niclas Hedhman (JIRA)" <ib...@incubator.apache.org> on 2007/09/14 06:12:32 UTC

[jira] Created: (IBATIS-458) maxWait in Throttle can fail.

maxWait in Throttle can fail.
-----------------------------

                 Key: IBATIS-458
                 URL: https://issues.apache.org/jira/browse/IBATIS-458
             Project: iBatis for Java
          Issue Type: Bug
            Reporter: Niclas Hedhman
            Priority: Minor


A possible bug, where it waits for the timeout:

    LOCK.wait(maxWait - totalWaitTime);

this is ok for the first time round the loop because maxWait is > 0 and totalWaitTime == 0
however, the subsequent check, for when the thread is interrupted mid-wait, is as follows: 

          if (totalWaitTime > maxWait) {
            throw new RuntimeException("Throttle waited too long (" + totalWaitTime + " milliseconds) for lock.");
          }

if totalWaitTime == maxWait then the loop will continue, and the thread will wait again at: 

    LOCK.wait(maxWait - totalWaitTime);

but now the remaining timeout is zero, which means wait forever!

The fix would be;

          if (totalWaitTime >= maxWait) { 
             throw new RuntimeException("Throttle waited too long (" + totalWaitTime + " milliseconds) for lock.");
           }
 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (IBATIS-458) maxWait in Throttle can fail.

Posted by "Clinton Begin (JIRA)" <ib...@incubator.apache.org>.
     [ https://issues.apache.org/jira/browse/IBATIS-458?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Clinton Begin closed IBATIS-458.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 2.3.1
         Assignee: Clinton Begin

Throttle is no more

> maxWait in Throttle can fail.
> -----------------------------
>
>                 Key: IBATIS-458
>                 URL: https://issues.apache.org/jira/browse/IBATIS-458
>             Project: iBatis for Java
>          Issue Type: Bug
>            Reporter: Niclas Hedhman
>            Assignee: Clinton Begin
>            Priority: Minor
>             Fix For: 2.3.1
>
>
> A possible bug, where it waits for the timeout:
>     LOCK.wait(maxWait - totalWaitTime);
> this is ok for the first time round the loop because maxWait is > 0 and totalWaitTime == 0
> however, the subsequent check, for when the thread is interrupted mid-wait, is as follows: 
>           if (totalWaitTime > maxWait) {
>             throw new RuntimeException("Throttle waited too long (" + totalWaitTime + " milliseconds) for lock.");
>           }
> if totalWaitTime == maxWait then the loop will continue, and the thread will wait again at: 
>     LOCK.wait(maxWait - totalWaitTime);
> but now the remaining timeout is zero, which means wait forever!
> The fix would be;
>           if (totalWaitTime >= maxWait) { 
>              throw new RuntimeException("Throttle waited too long (" + totalWaitTime + " milliseconds) for lock.");
>            }
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.