[ https://issues.apache.org/jira/browse/DRILL-5786?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16172350#comment-16172350 ]
Paul Rogers commented on DRILL-5786: ------------------------------------ The "external sort" cannot run out of memory in the RPC layer. The external sort is a specific module of code that does not directly interact with the RPC layer. The correct title here is "A query that contains a sort runs into an RPC exception". Clearly, we have issues with RPC and/or exchanges. These bugs affect many queries, including those with sorts. However, for proper categorization, this is not a "sort bug" per se. > External Sort encounters Exception in RPC communication during Sort > ------------------------------------------------------------------- > > Key: DRILL-5786 > URL: https://issues.apache.org/jira/browse/DRILL-5786 > Project: Apache Drill > Issue Type: Bug > Components: Execution - Relational Operators > Affects Versions: 1.11.0 > Reporter: Robert Hou > Assignee: Paul Rogers > Fix For: 1.12.0 > > Attachments: 2647d2b0-69bf-5a2b-0e23-81e8d49e464e.sys.drill, > drillbit.log > > > Query is: > {noformat} > select count(*) from (select * from > dfs.`/drill/testdata/resource-manager/3500cols.tbl` order by > columns[450],columns[330],columns[230],columns[220],columns[110],columns[90],columns[80],columns[70],columns[40],columns[10],columns[20],columns[30],columns[40],columns[50], > > columns[454],columns[413],columns[940],columns[834],columns[73],columns[140],columns[104],columns[2222],columns[30],columns[2420],columns[1520], > columns[1410], > columns[1110],columns[1290],columns[2380],columns[705],columns[45],columns[1054],columns[2430],columns[420],columns[404],columns[3350], > > columns[3333],columns[153],columns[356],columns[84],columns[745],columns[1450],columns[103],columns[2065],columns[343],columns[3420],columns[530], > columns[3210] ) d where d.col433 = 'sjka skjf' > {noformat} > This is the same query as DRILL-5670 but no session variables are set. > Here is the stack trace: > {noformat} > 2017-09-12 13:14:57,584 [BitServer-5] ERROR > o.a.d.exec.rpc.RpcExceptionHandler - Exception in RPC communication. > Connection: /10.10.100.190:31012 <--> /10.10.100.190:46230 (data server). > Closing connection. > io.netty.handler.codec.DecoderException: > org.apache.drill.exec.exception.OutOfMemoryException: Failure allocating > buffer. > at > io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:233) > ~[netty-codec-4.0.27.Final.jar:4.0.27.Final] > at > io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339) > [netty-transport-4.0.27.Final.jar:4.0.27.Final] > at > io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324) > [netty-transport-4.0.27.Final.jar:4.0.27.Final] > at > io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) > [netty-transport-4.0.27.Final.jar:4.0.27.Final] > at > io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339) > [netty-transport-4.0.27.Final.jar:4.0.27.Final] > at > io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324) > [netty-transport-4.0.27.Final.jar:4.0.27.Final] > at > io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:847) > [netty-transport-4.0.27.Final.jar:4.0.27.Final] > at > io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131) > [netty-transport-4.0.27.Final.jar:4.0.27.Final] > at > io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) > [netty-transport-4.0.27.Final.jar:4.0.27.Final] > at > io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) > [netty-transport-4.0.27.Final.jar:4.0.27.Final] > at > io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) > [netty-transport-4.0.27.Final.jar:4.0.27.Final] > at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) > [netty-transport-4.0.27.Final.jar:4.0.27.Final] > at > io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111) > [netty-common-4.0.27.Final.jar:4.0.27.Final] > at java.lang.Thread.run(Thread.java:745) [na:1.7.0_111] > Caused by: org.apache.drill.exec.exception.OutOfMemoryException: Failure > allocating buffer. > at > io.netty.buffer.PooledByteBufAllocatorL.allocate(PooledByteBufAllocatorL.java:64) > ~[drill-memory-base-1.12.0-SNAPSHOT.jar:4.0.27.Final] > at > org.apache.drill.exec.memory.AllocationManager.<init>(AllocationManager.java:81) > ~[drill-memory-base-1.12.0-SNAPSHOT.jar:1.12.0-SNAPSHOT] > at > org.apache.drill.exec.memory.BaseAllocator.bufferWithoutReservation(BaseAllocator.java:260) > ~[drill-memory-base-1.12.0-SNAPSHOT.jar:1.12.0-SNAPSHOT] > at > org.apache.drill.exec.memory.BaseAllocator.buffer(BaseAllocator.java:243) > ~[drill-memory-base-1.12.0-SNAPSHOT.jar:1.12.0-SNAPSHOT] > at > org.apache.drill.exec.memory.BaseAllocator.buffer(BaseAllocator.java:213) > ~[drill-memory-base-1.12.0-SNAPSHOT.jar:1.12.0-SNAPSHOT] > at > io.netty.buffer.ExpandableByteBuf.capacity(ExpandableByteBuf.java:43) > ~[drill-memory-base-1.12.0-SNAPSHOT.jar:4.0.27.Final] > at > io.netty.buffer.AbstractByteBuf.ensureWritable(AbstractByteBuf.java:251) > ~[netty-buffer-4.0.27.Final.jar:4.0.27.Final] > at > io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:849) > ~[netty-buffer-4.0.27.Final.jar:4.0.27.Final] > at > io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:841) > ~[netty-buffer-4.0.27.Final.jar:4.0.27.Final] > at > io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:831) > ~[netty-buffer-4.0.27.Final.jar:4.0.27.Final] > at > io.netty.handler.codec.ByteToMessageDecoder$1.cumulate(ByteToMessageDecoder.java:92) > ~[netty-codec-4.0.27.Final.jar:4.0.27.Final] > at > io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:227) > ~[netty-codec-4.0.27.Final.jar:4.0.27.Final] > ... 13 common frames omitted > Caused by: java.lang.OutOfMemoryError: Direct buffer memory > at java.nio.Bits.reserveMemory(Bits.java:631) ~[na:1.7.0_111] > at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:123) > ~[na:1.7.0_111] > at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:306) > ~[na:1.7.0_111] > at > io.netty.buffer.UnpooledUnsafeDirectByteBuf.allocateDirect(UnpooledUnsafeDirectByteBuf.java:108) > ~[netty-buffer-4.0.27.Final.jar:4.0.27.Final] > at > io.netty.buffer.UnpooledUnsafeDirectByteBuf.<init>(UnpooledUnsafeDirectByteBuf.java:69) > ~[netty-buffer-4.0.27.Final.jar:4.0.27.Final] > at > io.netty.buffer.UnpooledByteBufAllocator.newDirectBuffer(UnpooledByteBufAllocator.java:50) > ~[netty-buffer-4.0.27.Final.jar:4.0.27.Final] > at > io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:155) > ~[netty-buffer-4.0.27.Final.jar:4.0.27.Final] > at > io.netty.buffer.PooledByteBufAllocatorL$InnerAllocator.newDirectBufferL(PooledByteBufAllocatorL.java:155) > ~[drill-memory-base-1.12.0-SNAPSHOT.jar:4.0.27.Final] > at > io.netty.buffer.PooledByteBufAllocatorL$InnerAllocator.directBuffer(PooledByteBufAllocatorL.java:195) > ~[drill-memory-base-1.12.0-SNAPSHOT.jar:4.0.27.Final] > at > io.netty.buffer.PooledByteBufAllocatorL.allocate(PooledByteBufAllocatorL.java:62) > ~[drill-memory-base-1.12.0-SNAPSHOT.jar:4.0.27.Final] > ... 24 common frames omitted > 2017-09-12 13:14:57,586 [BitServer-5] INFO > o.a.d.exec.rpc.ProtobufLengthDecoder - Channel is closed, discarding > remaining 303657599 byte(s) in buffer. > 2017-09-12 13:14:57,757 [BitClient-1] WARN > o.a.d.exec.rpc.RpcExceptionHandler - Exception occurred with closed channel. > Connection: /10.10.100.190:46230 <--> qa-node190.qa.lab/10.10.100.190:31012 > (data client) > {noformat} > Plan is: > {noformat} > | 00-00 Screen > 00-01 Project(EXPR$0=[$0]) > 00-02 StreamAgg(group=[{}], EXPR$0=[COUNT()]) > 00-03 Project($f0=[0]) > 00-04 SelectionVectorRemover > 00-05 Filter(condition=[=(ITEM($0, 'col433'), 'sjka skjf')]) > 00-06 Project(T7¦¦*=[$0]) > 00-07 SelectionVectorRemover > 00-08 Sort(sort0=[$1], sort1=[$2], sort2=[$3], sort3=[$4], > sort4=[$5], sort5=[$6], sort6=[$7], sort7=[$8], sort8=[$9], sort9=[$10], > sort10=[$11], sort11=[$12], sort12=[$9], sort13=[$13], sort14=[$14], > sort15=[$15], sort16=[$16], sort17=[$17], sort18=[$18], sort19=[$19], > sort20=[$20], sort21=[$21], sort22=[$12], sort23=[$22], sort24=[$23], > sort25=[$24], sort26=[$25], sort27=[$26], sort28=[$27], sort29=[$28], > sort30=[$29], sort31=[$30], sort32=[$31], sort33=[$32], sort34=[$33], > sort35=[$34], sort36=[$35], sort37=[$36], sort38=[$37], sort39=[$38], > sort40=[$39], sort41=[$40], sort42=[$41], sort43=[$42], sort44=[$43], > sort45=[$44], sort46=[$45], sort47=[$46], dir0=[ASC], dir1=[ASC], dir2=[ASC], > dir3=[ASC], dir4=[ASC], dir5=[ASC], dir6=[ASC], dir7=[ASC], dir8=[ASC], > dir9=[ASC], dir10=[ASC], dir11=[ASC], dir12=[ASC], dir13=[ASC], dir14=[ASC], > dir15=[ASC], dir16=[ASC], dir17=[ASC], dir18=[ASC], dir19=[ASC], dir20=[ASC], > dir21=[ASC], dir22=[ASC], dir23=[ASC], dir24=[ASC], dir25=[ASC], dir26=[ASC], > dir27=[ASC], dir28=[ASC], dir29=[ASC], dir30=[ASC], dir31=[ASC], dir32=[ASC], > dir33=[ASC], dir34=[ASC], dir35=[ASC], dir36=[ASC], dir37=[ASC], dir38=[ASC], > dir39=[ASC], dir40=[ASC], dir41=[ASC], dir42=[ASC], dir43=[ASC], dir44=[ASC], > dir45=[ASC], dir46=[ASC], dir47=[ASC]) > 00-09 Project(T7¦¦*=[$0], EXPR$1=[ITEM($1, 450)], > EXPR$2=[ITEM($1, 330)], EXPR$3=[ITEM($1, 230)], EXPR$4=[ITEM($1, 220)], > EXPR$5=[ITEM($1, 110)], EXPR$6=[ITEM($1, 90)], EXPR$7=[ITEM($1, 80)], > EXPR$8=[ITEM($1, 70)], EXPR$9=[ITEM($1, 40)], EXPR$10=[ITEM($1, 10)], > EXPR$11=[ITEM($1, 20)], EXPR$12=[ITEM($1, 30)], EXPR$13=[ITEM($1, 50)], > EXPR$14=[ITEM($1, 454)], EXPR$15=[ITEM($1, 413)], EXPR$16=[ITEM($1, 940)], > EXPR$17=[ITEM($1, 834)], EXPR$18=[ITEM($1, 73)], EXPR$19=[ITEM($1, 140)], > EXPR$20=[ITEM($1, 104)], EXPR$21=[ITEM($1, 2222)], EXPR$22=[ITEM($1, 2420)], > EXPR$23=[ITEM($1, 1520)], EXPR$24=[ITEM($1, 1410)], EXPR$25=[ITEM($1, 1110)], > EXPR$26=[ITEM($1, 1290)], EXPR$27=[ITEM($1, 2380)], EXPR$28=[ITEM($1, 705)], > EXPR$29=[ITEM($1, 45)], EXPR$30=[ITEM($1, 1054)], EXPR$31=[ITEM($1, 2430)], > EXPR$32=[ITEM($1, 420)], EXPR$33=[ITEM($1, 404)], EXPR$34=[ITEM($1, 3350)], > EXPR$35=[ITEM($1, 3333)], EXPR$36=[ITEM($1, 153)], EXPR$37=[ITEM($1, 356)], > EXPR$38=[ITEM($1, 84)], EXPR$39=[ITEM($1, 745)], EXPR$40=[ITEM($1, 1450)], > EXPR$41=[ITEM($1, 103)], EXPR$42=[ITEM($1, 2065)], EXPR$43=[ITEM($1, 343)], > EXPR$44=[ITEM($1, 3420)], EXPR$45=[ITEM($1, 530)], EXPR$46=[ITEM($1, 3210)]) > 00-10 Project(T7¦¦*=[$0], columns=[$1]) > 00-11 Scan(groupscan=[EasyGroupScan > [selectionRoot=maprfs:/drill/testdata/resource-manager/3500cols.tbl, > numFiles=1, columns=[`*`], > files=[maprfs:///drill/testdata/resource-manager/3500cols.tbl]]]) > {noformat} > sing q10 -- This message was sent by Atlassian JIRA (v6.4.14#64029)