You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "David Li (Jira)" <ji...@apache.org> on 2021/02/01 14:00:01 UTC
[jira] [Commented] (ARROW-11066) [Java] Is there a bug in flight
AddWritableBuffer
[ https://issues.apache.org/jira/browse/ARROW-11066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17276338#comment-17276338 ]
David Li commented on ARROW-11066:
----------------------------------
Fixing the optimization exposes a SIGSEGV. It looks like in some cases, the buffer is freed before gRPC/Netty get a chance to copy it.
{noformat}
Stack: [0x00007f41987e3000,0x00007f41988e4000], sp=0x00007f41988e0238, free space=1012k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0xa486f0]
J 1792 jdk.internal.misc.Unsafe.copyMemory0(Ljava/lang/Object;JLjava/lang/Object;JJ)V java.base@11.0.8 (0 bytes) @ 0x00007f41d0475534 [0x00007f41d0475440+0x00000000000000f4]
J 1790 c1 jdk.internal.misc.Unsafe.copyMemory(Ljava/lang/Object;JLjava/lang/Object;JJ)V java.base@11.0.8 (33 bytes) @ 0x00007f41c916f1ac [0x00007f41c916e960+0x000000000000084c]
J 2427 c1 io.netty.util.internal.PlatformDependent.copyMemory(JJJ)V (8 bytes) @ 0x00007f41c9274604 [0x00007f41c9274480+0x0000000000000184]
j io.netty.buffer.UnsafeByteBufUtil.getBytes(Lio/netty/buffer/AbstractByteBuf;JILio/netty/buffer/ByteBuf;II)V+79
j io.netty.buffer.UnpooledUnsafeDirectByteBuf.getBytes(ILio/netty/buffer/ByteBuf;II)Lio/netty/buffer/ByteBuf;+11
j io.netty.buffer.CompositeByteBuf.getBytes(ILio/netty/buffer/ByteBuf;II)Lio/netty/buffer/CompositeByteBuf;+69
j io.netty.buffer.CompositeByteBuf.getBytes(ILio/netty/buffer/ByteBuf;II)Lio/netty/buffer/ByteBuf;+6
j io.netty.buffer.AbstractUnpooledSlicedByteBuf.getBytes(ILio/netty/buffer/ByteBuf;II)Lio/netty/buffer/ByteBuf;+20
j io.netty.buffer.UnsafeByteBufUtil.setBytes(Lio/netty/buffer/AbstractByteBuf;JILio/netty/buffer/ByteBuf;II)V+129
j io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(ILio/netty/buffer/ByteBuf;II)Lio/netty/buffer/ByteBuf;+11
j io.netty.buffer.AbstractByteBuf.writeBytes(Lio/netty/buffer/ByteBuf;II)Lio/netty/buffer/ByteBuf;+14
j io.netty.channel.epoll.AbstractEpollChannel.newDirectBuffer0(Ljava/lang/Object;Lio/netty/buffer/ByteBuf;Lio/netty/buffer/ByteBufAllocator;I)Lio/netty/buffer/ByteBuf;+17
j io.netty.channel.epoll.AbstractEpollChannel.newDirectBuffer(Ljava/lang/Object;Lio/netty/buffer/ByteBuf;)Lio/netty/buffer/ByteBuf;+39
j io.netty.channel.epoll.AbstractEpollChannel.newDirectBuffer(Lio/netty/buffer/ByteBuf;)Lio/netty/buffer/ByteBuf;+3
j io.netty.channel.epoll.AbstractEpollStreamChannel.filterOutboundMessage(Ljava/lang/Object;)Ljava/lang/Object;+21
j io.netty.channel.AbstractChannel$AbstractUnsafe.write(Ljava/lang/Object;Lio/netty/channel/ChannelPromise;)V+40
J 2392 c1 io.netty.channel.DefaultChannelPipeline$HeadContext.write(Lio/netty/channel/ChannelHandlerContext;Ljava/lang/Object;Lio/netty/channel/ChannelPromise;)V (12 bytes) @ 0x00007f41c9263d84 [0x00007f41c9263c40+0x0000000000000144]
J 2408 c1 io.netty.channel.AbstractChannelHandlerContext.write(Ljava/lang/Object;ZLio/netty/channel/ChannelPromise;)V (146 bytes) @ 0x00007f41c926f75c [0x00007f41c926da20+0x0000000000001d3c]
j io.netty.channel.AbstractChannelHandlerContext.write(Ljava/lang/Object;Lio/netty/channel/ChannelPromise;)Lio/netty/channel/ChannelFuture;+4
j io.netty.handler.codec.http2.DefaultHttp2FrameWriter.writeData(Lio/netty/channel/ChannelHandlerContext;ILio/netty/buffer/ByteBuf;IZLio/netty/channel/ChannelPromise;)Lio/netty/channel/ChannelFuture;+134
j io.netty.handler.codec.http2.Http2OutboundFrameLogger.writeData(Lio/netty/channel/ChannelHandlerContext;ILio/netty/buffer/ByteBuf;IZLio/netty/channel/ChannelPromise;)Lio/netty/channel/ChannelFuture;+30
j io.netty.handler.codec.http2.DecoratingHttp2FrameWriter.writeData(Lio/netty/channel/ChannelHandlerContext;ILio/netty/buffer/ByteBuf;IZLio/netty/channel/ChannelPromise;)Lio/netty/channel/ChannelFuture;+13
j io.grpc.netty.NettyServerHandler$WriteMonitoringFrameWriter.writeData(Lio/netty/channel/ChannelHandlerContext;ILio/netty/buffer/ByteBuf;IZLio/netty/channel/ChannelPromise;)Lio/netty/channel/ChannelFuture;+17
j io.netty.handler.codec.http2.DefaultHttp2ConnectionEncoder$FlowControlledData.write(Lio/netty/channel/ChannelHandlerContext;I)V+192
j io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController$FlowState.writeAllocatedBytes(I)I+106
j io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController$WritabilityMonitor.write(Lio/netty/handler/codec/http2/Http2Stream;I)V+9
j io.netty.handler.codec.http2.WeightedFairQueueByteDistributor$State.write(ILio/netty/handler/codec/http2/StreamByteDistributor$Writer;)V+27
j io.netty.handler.codec.http2.WeightedFairQueueByteDistributor.distribute(ILio/netty/handler/codec/http2/StreamByteDistributor$Writer;Lio/netty/handler/codec/http2/WeightedFairQueueByteDistributor$State;)I+21
j io.netty.handler.codec.http2.WeightedFairQueueByteDistributor.distributeToChildren(ILio/netty/handler/codec/http2/StreamByteDistributor$Writer;Lio/netty/handler/codec/http2/WeightedFairQueueByteDistributor$State;)I+174
j io.netty.handler.codec.http2.WeightedFairQueueByteDistributor.distribute(ILio/netty/handler/codec/http2/StreamByteDistributor$Writer;)Z+28
j io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController$WritabilityMonitor.writePendingBytes()V+30
j io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController.writePendingBytes()V+4
j io.netty.handler.codec.http2.Http2ConnectionHandler.flush(Lio/netty/channel/ChannelHandlerContext;)V+9
j io.netty.handler.codec.http2.Http2ConnectionHandler.channelWritabilityChanged(Lio/netty/channel/ChannelHandlerContext;)V+16
j io.netty.channel.AbstractChannelHandlerContext.invokeChannelWritabilityChanged()V+15
j io.netty.channel.AbstractChannelHandlerContext.invokeChannelWritabilityChanged(Lio/netty/channel/AbstractChannelHandlerContext;)V+15
j io.netty.channel.AbstractChannelHandlerContext.fireChannelWritabilityChanged()Lio/netty/channel/ChannelHandlerContext;+7
j io.netty.channel.DefaultChannelPipeline$HeadContext.channelWritabilityChanged(Lio/netty/channel/ChannelHandlerContext;)V+1
j io.netty.channel.AbstractChannelHandlerContext.invokeChannelWritabilityChanged()V+15
j io.netty.channel.AbstractChannelHandlerContext.invokeChannelWritabilityChanged(Lio/netty/channel/AbstractChannelHandlerContext;)V+15
j io.netty.channel.DefaultChannelPipeline.fireChannelWritabilityChanged()Lio/netty/channel/ChannelPipeline;+4
j io.netty.channel.ChannelOutboundBuffer.fireChannelWritabilityChanged(Z)V+57
j io.netty.channel.ChannelOutboundBuffer.setWritable(Z)V+32
J 2360 c1 io.netty.channel.ChannelOutboundBuffer.decrementPendingOutboundBytes(JZZ)V (50 bytes) @ 0x00007f41c9257aa4 [0x00007f41c92575a0+0x0000000000000504]
J 2393 c1 io.netty.channel.ChannelOutboundBuffer.remove()Z (66 bytes) @ 0x00007f41c926694c [0x00007f41c9264ea0+0x0000000000001aac]
j io.netty.channel.ChannelOutboundBuffer.removeBytes(J)V+83
j io.netty.channel.epoll.AbstractEpollStreamChannel.writeBytesMultiple(Lio/netty/channel/ChannelOutboundBuffer;Lio/netty/channel/unix/IovArray;)I+87
j io.netty.channel.epoll.AbstractEpollStreamChannel.doWriteMultiple(Lio/netty/channel/ChannelOutboundBuffer;)I+45
j io.netty.channel.epoll.AbstractEpollStreamChannel.doWrite(Lio/netty/channel/ChannelOutboundBuffer;)V+31
j io.netty.channel.AbstractChannel$AbstractUnsafe.flush0()V+103
j io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.flush0()V+14
j io.netty.channel.AbstractChannel$AbstractUnsafe.flush()V+19
j io.netty.channel.DefaultChannelPipeline$HeadContext.flush(Lio/netty/channel/ChannelHandlerContext;)V+4
j io.netty.channel.AbstractChannelHandlerContext.invokeFlush0()V+8
j io.netty.channel.AbstractChannelHandlerContext.invokeFlush()V+8
{noformat}
> [Java] Is there a bug in flight AddWritableBuffer
> -------------------------------------------------
>
> Key: ARROW-11066
> URL: https://issues.apache.org/jira/browse/ARROW-11066
> Project: Apache Arrow
> Issue Type: Bug
> Components: FlightRPC, Java
> Affects Versions: 1.0.0
> Reporter: Kangping Huang
> Assignee: David Li
> Priority: Major
> Labels: pull-request-available
> Fix For: 4.0.0
>
> Time Spent: 2.5h
> Remaining Estimate: 0h
>
> [https://github.com/apache/arrow/blob/9bab12f03ac486bb8270f031b83f0a0411766b3e/java/flight/flight-core/src/main/java/org/apache/arrow/flight/grpc/AddWritableBuffer.java#L94]
> buf.readBytes(stream, buf.readableBytes());
> is this line redundant
> In my perf.svg, this will copy the data from buf to OutputStream, which can not realize zero-copy.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)