[
https://issues.apache.org/jira/browse/BOOKKEEPER-924?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15254712#comment-15254712
]
ASF GitHub Bot commented on BOOKKEEPER-924:
-------------------------------------------
GitHub user jvrao opened a pull request:
https://github.com/apache/bookkeeper/pull/38
BOOKKEEPER-924 Handle Spurious wakeups
SyncCounter doesn't handle Spurious wakeups.
Make use of CountDownLatch latch instead of native counter
Signed-off-by: Venkateswararao Jujjuri (JV) <[email protected]>
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/jvrao/bookkeeper bk_924
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/bookkeeper/pull/38.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #38
----
commit 74167b16aa9b2c87ee2c2001d5c6d5322036b6cd
Author: JV <[email protected]>
Date: 2016-04-22T18:00:22Z
BOOKKEEPER-924 Handle Spurious wakeups
SyncCounter doesn't handle Spurious wakeups.
Make use of CountDownLatch latch instead of native counter
Signed-off-by: Venkateswararao Jujjuri (JV) <[email protected]>
----
> addEntry() is susceptible to spurious wakeups
> ---------------------------------------------
>
> Key: BOOKKEEPER-924
> URL: https://issues.apache.org/jira/browse/BOOKKEEPER-924
> Project: Bookkeeper
> Issue Type: Bug
> Reporter: Venkateswararao Jujjuri (JV)
> Assignee: Venkateswararao Jujjuri (JV)
> Priority: Critical
>
> LedgerHandle sync interface heavily depends on SyncCounter to convert async
> interfaces
> into sync interfaces.
> Usaylly
> SyncCounter.inc()
> asyncCall()
> SyncCOunter.block(0)
> The block code is.
> synchronized void block(int limit) throws InterruptedException {
> while (i > limit) {
> int prev = i;
> wait();
> if (i == prev) {
> break;
> }
> }
> }
> Since 'i' is going to be same as 'prev' on spurious wakeup, and wait() can
> return on spurious wakeups.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)