You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bookkeeper.apache.org by "Charan Reddy Guttapalem (JIRA)" <ji...@apache.org> on 2016/10/19 22:32:58 UTC
[jira] [Created] (BOOKKEEPER-957) issues in LedgerHandleAdv
Charan Reddy Guttapalem created BOOKKEEPER-957:
--------------------------------------------------
Summary: issues in LedgerHandleAdv
Key: BOOKKEEPER-957
URL: https://issues.apache.org/jira/browse/BOOKKEEPER-957
Project: Bookkeeper
Issue Type: Bug
Reporter: Charan Reddy Guttapalem
Assignee: Charan Reddy Guttapalem
1) In LedgerHandleAdv in doAsyncAddEntry method, addToLength(length) call is not synchronized
In LedgerHandleAdv in doAsyncAddEntry method, call to addToLength(length) is not synchronized.
addEntry method is supposed to be thread safe, so when addEntry method of LedgerHandleAdv is called concurrently from multiple threads, addToLength will be messed up because its call is not synchrnoized.
in LedgerHandle it is synchronized over 'this'.
2) In LedgerHandleAdv, in asyncAddEntry it is incorrect to add 'op' to 'pendingAddOps' before calling doAsyncAddEntry
In LedgerHandleAdv, in asyncAddEntry, it is incorrect to add 'op' to 'pendingAddOps' before calling doAsyncAddEntry.
Consider the following example,
Lets say "asyncAddEntry(final long entryId, final byte[] data, final int offset, final int length, final AddCallback cb, final Object ctx)" is called with incorrect arguments, and following condition is failed "(offset < 0 || length < 0 || (offset + length) > data.length)". Then as expected we would get ArrayIndexOutOfBoundsException, but now if we try to call asyncAddEntry with correct arguments for that entry, then it will fail with "DuplicateEntryIdException", since the op is added already in the previous call, which shouldn't have happened.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)