[ 
https://issues.apache.org/jira/browse/ARTEMIS-2496?focusedWorklogId=314903&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-314903
 ]

ASF GitHub Bot logged work on ARTEMIS-2496:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 19/Sep/19 08:32
            Start Date: 19/Sep/19 08:32
    Worklog Time Spent: 10m 
      Work Description: wy96f commented on issue #2843: ARTEMIS-2496 Revert 
catch up with zero-copy, as it's causing issues i…
URL: https://github.com/apache/activemq-artemis/pull/2843#issuecomment-533027655
 
 
   @clebertsuconic @franz1981 Hi, I didn't use wildfly/xnio. Will xnio use a 
HttpConnection which implements Connection like InVMConnection/NettyConnection?
   
   ```
            if (connection != null && connection.getTransportConnection() 
instanceof NettyConnection) {
               bufferSize -= dataSize;
               isNetty = true;
            }
            buffer = createPacket(connection, bufferSize);
            encodeHeader(buffer);
            encodeRest(buffer, connection);
            if (!isNetty) {
               if (buffer.byteBuf() != null && 
buffer.byteBuf().nioBufferCount() == 1 && buffer.byteBuf().isDirect()) {
                  final ByteBuffer byteBuffer = 
buffer.byteBuf().internalNioBuffer(buffer.writerIndex(), 
buffer.writableBytes());
                  readFile(byteBuffer);
               } else {
                  final ByteBuf byteBuffer = 
PooledByteBufAllocator.DEFAULT.directBuffer(buffer.writableBytes(), 
buffer.writableBytes());
                  try {
                     final ByteBuffer nioBuffer = 
byteBuffer.internalNioBuffer(0, buffer.writableBytes());
                     final int readBytes = readFile(nioBuffer);
                     if (readBytes > 0) {
                        //still use byteBuf to copy data
                        buffer.writeBytes(byteBuffer, 0, readBytes);
                     }
                  } finally {
                     byteBuffer.release();
                  }
               }
               buffer.writerIndex(buffer.capacity());
            }
            encodeSize(buffer, encodedSize);
            return buffer;
   ```
   If not NettyConnection, file data will be read into buffer.
   
   Then in ChannelImpl::send
   ```
   connection.getTransportConnection().write(buffer);
   connection.getTransportConnection().write(raf, fileChannel, offset, 
dataSize, callback == null ? null : (ChannelFutureListener) future -> 
callback.done(future == null || future.isSuccess()));
   ```
   Both buffer and file will be written. For InVMConnection, actually no file 
data is transferred:
   ```
      @Override
      public void write(RandomAccessFile raf,
                        FileChannel fileChannel,
                        long offset,
                        int dataSize,
                        final ChannelFutureListener futureListener) {
         if (futureListener == null) {
            return;
         }
         try {
            executor.execute(() -> {
               try {
                  futureListener.operationComplete(null);
               } catch (Exception e) {
                  throw new IllegalStateException(e);
               }
            });
         } catch (RejectedExecutionException e) {
   
         }
      }
   ```
   But if xnio implements a connection and transfers file data one more time in 
file send method, the mechanism is broken. Not sure if it is caused by this?
 
----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 314903)
    Time Spent: 1.5h  (was: 1h 20m)

> Use of Netty FileRegion on ReplicationCatch is breaking wildfly integration 
> with artemis
> ----------------------------------------------------------------------------------------
>
>                 Key: ARTEMIS-2496
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2496
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>    Affects Versions: 2.10.0
>            Reporter: clebert suconic
>            Assignee: clebert suconic
>            Priority: Major
>             Fix For: 2.11.0
>
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> This is of course an issue on Wildfly integration, but it seems something on 
> our recent changes is breaking replication on Wildfly.
> My biggest concern is that it seems that paging catch up is silently failing 
> in our testsuite and some other issues are currently hidden.
> Wildfly has an extra layer on top of Netty: 
> https://github.com/xnio/netty-xnio-transport/tree/0.1
> But the main thing here, is that it seems that are other issues within 
> Artemis.
> For now I'm reverting the change from ARTEMIS-2336
> And we need more investigation to bring it back



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to