szetszwo commented on pull request #3195:
URL: https://github.com/apache/ozone/pull/3195#issuecomment-1071944122


   > Do we need add some logs to debug the cause of the bug?
   
   We already added the indices in the exception message as below.  The indices 
are totally wrong.  It seems there are some synchronization problem
   ```
   Caused by: java.io.IOException: Failed to readPutBlockRequest from 
ReadOnlyByteBuf(ridx: 0, widx: 1054872, cap: 1054872,
    unwrapped: CompositeByteBuf(ridx: 0, widx: 1054872, cap: 1054872, 
components=25)):
    readerIndex=0, protoIndex=0, protoLength=0, lengthIndex=1054868
   ```
   Please feel free to add more log messages for debugging.
   
   @captainzmc , I suspect the synchronization problem is in Ratis.  Could you 
try apply below to Ratis and test it?
   ```
   +++ 
b/ratis-netty/src/main/java/org/apache/ratis/netty/server/DataStreamManagement.java
   @@ -279,9 +279,7 @@ public class DataStreamManagement {
    
      static <T> CompletableFuture<T> 
composeAsync(AtomicReference<CompletableFuture<T>> future, Executor executor,
          Function<T, CompletableFuture<T>> function) {
   -    final CompletableFuture<T> composed = 
future.get().thenComposeAsync(function, executor);
   -    future.set(composed);
   -    return composed;
   +    return future.updateAndGet(previous -> 
previous.thenComposeAsync(function, executor));
      }
    
      static CompletableFuture<Long> writeToAsync(ByteBuf buf, WriteOption[] 
options, DataStream stream,
   ```
   


-- 
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to