lhotari commented on PR #4196:
URL: https://github.com/apache/bookkeeper/pull/4196#issuecomment-1927054657

   > This issue may also be related ? 
[apache/pulsar#21892](https://github.com/apache/pulsar/issues/21892) I got some 
exceptions and tracked it for quite some time @lhotari
   > 
   > ```java
   > 14:29:19.961 [BookKeeperClientWorker-OrderedExecutor-2-0] ERROR 
org.apache.bookkeeper.common.util.SingleThreadExecutor - Error while running 
task: readerIndex: 31215, writerIndex: 21324 (expected: 0 <= readerIndex <= 
writerIndex <= capacity(65536))
   > java.lang.IndexOutOfBoundsException: readerIndex: 31215, writerIndex: 
21324 (expected: 0 <= readerIndex <= writerIndex <= capacity(65536))
   >    at 
io.netty.buffer.AbstractByteBuf.checkIndexBounds(AbstractByteBuf.java:112) 
~[io.netty-netty-buffer-4.1.104.Final.jar:4.1.104.Final]
   >    at io.netty.buffer.AbstractByteBuf.setIndex(AbstractByteBuf.java:144) 
~[io.netty-netty-buffer-4.1.104.Final.jar:4.1.104.Final]
   >    at io.netty.buffer.DuplicatedByteBuf.<init>(DuplicatedByteBuf.java:56) 
~[io.netty-netty-buffer-4.1.104.Final.jar:4.1.104.Final]
   >    at io.netty.buffer.DuplicatedByteBuf.<init>(DuplicatedByteBuf.java:42) 
~[io.netty-netty-buffer-4.1.104.Final.jar:4.1.104.Final]
   >    at 
io.netty.buffer.UnpooledDuplicatedByteBuf.<init>(UnpooledDuplicatedByteBuf.java:24)
 ~[io.netty-netty-buffer-4.1.104.Final.jar:4.1.104.Final]
   >    at 
io.netty.buffer.AbstractPooledDerivedByteBuf$PooledNonRetainedDuplicateByteBuf.<init>(AbstractPooledDerivedByteBuf.java:164)
 ~[io.netty-netty-buffer-4.1.104.Final.jar:4.1.104.Final]
   >    at 
io.netty.buffer.AbstractPooledDerivedByteBuf.duplicate0(AbstractPooledDerivedByteBuf.java:157)
 ~[io.netty-netty-buffer-4.1.104.Final.jar:4.1.104.Final]
   >    at 
io.netty.buffer.PooledSlicedByteBuf.duplicate(PooledSlicedByteBuf.java:118) 
~[io.netty-netty-buffer-4.1.104.Final.jar:4.1.104.Final]
   >    at 
io.netty.buffer.CompositeByteBuf$Component.duplicate(CompositeByteBuf.java:1947)
 ~[io.netty-netty-buffer-4.1.104.Final.jar:4.1.104.Final]
   >    at 
io.netty.buffer.CompositeByteBuf.component(CompositeByteBuf.java:1556) 
~[io.netty-netty-buffer-4.1.104.Final.jar:4.1.104.Final]
   >    at 
org.apache.bookkeeper.proto.checksum.DigestManager.computeDigestAndPackageForSendingV2(DigestManager.java:149)
 ~[bookkeeper-server-4.17.0-SNAPSHOT.jar:4.17.0-SNAPSHOT]
   >    at 
org.apache.bookkeeper.proto.checksum.DigestManager.computeDigestAndPackageForSending(DigestManager.java:106)
 ~[bookkeeper-server-4.17.0-SNAPSHOT.jar:4.17.0-SNAPSHOT]
   >    at 
org.apache.bookkeeper.client.PendingAddOp.initiate(PendingAddOp.java:246) 
~[bookkeeper-server-4.17.0-SNAPSHOT.jar:4.17.0-SNAPSHOT]
   >    at 
org.apache.bookkeeper.client.LedgerHandle.doAsyncAddEntry(LedgerHandle.java:1363)
 ~[bookkeeper-server-4.17.0-SNAPSHOT.jar:4.17.0-SNAPSHOT]
   >    at 
org.apache.bookkeeper.client.LedgerHandle.asyncAddEntry(LedgerHandle.java:1061) 
~[bookkeeper-server-4.17.0-SNAPSHOT.jar:4.17.0-SNAPSHOT]
   >    at 
org.apache.bookkeeper.mledger.impl.OpAddEntry.initiate(OpAddEntry.java:144) 
~[org.apache.pulsar-managed-ledger-3.3.0-SNAPSHOT.jar:3.3.0-SNAPSHOT]
   >    at 
org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl.internalAsyncAddEntry(ManagedLedgerImpl.java:862)
 ~[org.apache.pulsar-managed-ledger-3.3.0-SNAPSHOT.jar:3.3.0-SNAPSHOT]
   >    at 
org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl.lambda$asyncAddEntry$3(ManagedLedgerImpl.java:794)
 ~[org.apache.pulsar-managed-ledger-3.3.0-SNAPSHOT.jar:3.3.0-SNAPSHOT]
   >    at 
org.apache.bookkeeper.common.util.SingleThreadExecutor.safeRunTask(SingleThreadExecutor.java:137)
 ~[org.apache.bookkeeper-bookkeeper-common-4.16.3.jar:4.16.3]
   >    at 
org.apache.bookkeeper.common.util.SingleThreadExecutor.run(SingleThreadExecutor.java:107)
 ~[org.apache.bookkeeper-bookkeeper-common-4.16.3.jar:4.16.3]
   >    at 
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
 ~[io.netty-netty-common-4.1.104.Final.jar:4.1.104.Final]
   >    at java.lang.Thread.run(Thread.java:833) ~[?:?]
   > ```
   
   @graysonzeng This looks like a multi-threading / thread-safety issue. 
Possibly multiple threads are mutating the same Netty ByteBuf instance. ByteBuf 
isn't thread safe. It might not be related to the problem that this PR is 
fixing.
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to