[
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.