Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-5805

External Sort runs out of memory

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.11.0
    • None
    • None

    Description

      Query is:

      ALTER SESSION SET `exec.sort.disable_managed` = false;
      alter session set `planner.width.max_per_node` = 5;
      alter session set `planner.disable_exchanges` = true;
      alter session set `planner.width.max_per_query` = 100;
      select count(*) from (select * from (select id, flatten(str_list) str from dfs.`/drill/testdata/resource-manager/flatten-large-small.json`) d order by d.str) d1 where d1.id=0;
      

      Error is:

      java.sql.SQLException: RESOURCE ERROR: Unable to allocate sv2 buffer
      
      Fragment 0:0
      
      [Error Id: d67e087f-30e3-4861-8d3a-ddd952ddacc1 on atsqa6c83.qa.lab:31010]
      
        (org.apache.drill.exec.exception.OutOfMemoryException) Unable to allocate sv2 buffer
          org.apache.drill.exec.physical.impl.xsort.managed.BufferedBatches.newSV2():157
          org.apache.drill.exec.physical.impl.xsort.managed.BufferedBatches.makeSelectionVector():142
          org.apache.drill.exec.physical.impl.xsort.managed.BufferedBatches.add():97
          org.apache.drill.exec.physical.impl.xsort.managed.SortImpl.addBatch():265
          org.apache.drill.exec.physical.impl.xsort.managed.ExternalSortBatch.loadBatch():422
          org.apache.drill.exec.physical.impl.xsort.managed.ExternalSortBatch.load():358
          org.apache.drill.exec.physical.impl.xsort.managed.ExternalSortBatch.innerNext():303
          org.apache.drill.exec.record.AbstractRecordBatch.next():164
          org.apache.drill.exec.record.AbstractRecordBatch.next():119
          org.apache.drill.exec.record.AbstractRecordBatch.next():109
          org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext():51
          org.apache.drill.exec.physical.impl.svremover.RemovingRecordBatch.innerNext():93
          org.apache.drill.exec.record.AbstractRecordBatch.next():164
          org.apache.drill.exec.record.AbstractRecordBatch.next():119
          org.apache.drill.exec.record.AbstractRecordBatch.next():109
          org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext():51
          org.apache.drill.exec.record.AbstractRecordBatch.next():164
          org.apache.drill.exec.record.AbstractRecordBatch.next():119
          org.apache.drill.exec.record.AbstractRecordBatch.next():109
          org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext():51
          org.apache.drill.exec.physical.impl.svremover.RemovingRecordBatch.innerNext():93
          org.apache.drill.exec.record.AbstractRecordBatch.next():164
          org.apache.drill.exec.record.AbstractRecordBatch.next():119
          org.apache.drill.exec.record.AbstractRecordBatch.next():109
          org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext():51
          org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext():133
          org.apache.drill.exec.record.AbstractRecordBatch.next():164
          org.apache.drill.exec.record.AbstractRecordBatch.next():119
          org.apache.drill.exec.record.AbstractRecordBatch.next():109
          org.apache.drill.exec.physical.impl.aggregate.StreamingAggBatch.innerNext():151
          org.apache.drill.exec.record.AbstractRecordBatch.next():164
          org.apache.drill.exec.record.AbstractRecordBatch.next():119
          org.apache.drill.exec.record.AbstractRecordBatch.next():109
          org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext():51
          org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext():133
          org.apache.drill.exec.record.AbstractRecordBatch.next():164
          org.apache.drill.exec.physical.impl.BaseRootExec.next():105
          org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.innerNext():81
          org.apache.drill.exec.physical.impl.BaseRootExec.next():95
          org.apache.drill.exec.work.fragment.FragmentExecutor$1.run():234
          org.apache.drill.exec.work.fragment.FragmentExecutor$1.run():227
          java.security.AccessController.doPrivileged():-2
          javax.security.auth.Subject.doAs():415
          org.apache.hadoop.security.UserGroupInformation.doAs():1595
          org.apache.drill.exec.work.fragment.FragmentExecutor.run():227
          org.apache.drill.common.SelfCleaningRunnable.run():38
          java.util.concurrent.ThreadPoolExecutor.runWorker():1145
          java.util.concurrent.ThreadPoolExecutor$Worker.run():615
          java.lang.Thread.run():744
      
      	at org.apache.drill.jdbc.impl.DrillCursor.nextRowInternally(DrillCursor.java:489)
      	at org.apache.drill.jdbc.impl.DrillCursor.next(DrillCursor.java:593)
      	at oadd.org.apache.calcite.avatica.AvaticaResultSet.next(AvaticaResultSet.java:215)
      	at org.apache.drill.jdbc.impl.DrillResultSetImpl.next(DrillResultSetImpl.java:140)
      	at org.apache.drill.test.framework.DrillTestJdbc.executeSetupQuery(DrillTestJdbc.java:193)
      	at org.apache.drill.test.framework.DrillTestJdbc.run(DrillTestJdbc.java:111)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:744)
      Caused by: oadd.org.apache.drill.common.exceptions.UserRemoteException: RESOURCE ERROR: Unable to allocate sv2 buffer
      
      Fragment 0:0
      
      [Error Id: d67e087f-30e3-4861-8d3a-ddd952ddacc1 on atsqa6c83.qa.lab:31010]
      
        (org.apache.drill.exec.exception.OutOfMemoryException) Unable to allocate sv2 buffer
          org.apache.drill.exec.physical.impl.xsort.managed.BufferedBatches.newSV2():157
          org.apache.drill.exec.physical.impl.xsort.managed.BufferedBatches.makeSelectionVector():142
          org.apache.drill.exec.physical.impl.xsort.managed.BufferedBatches.add():97
          org.apache.drill.exec.physical.impl.xsort.managed.SortImpl.addBatch():265
          org.apache.drill.exec.physical.impl.xsort.managed.ExternalSortBatch.loadBatch():422
          org.apache.drill.exec.physical.impl.xsort.managed.ExternalSortBatch.load():358
          org.apache.drill.exec.physical.impl.xsort.managed.ExternalSortBatch.innerNext():303
          org.apache.drill.exec.record.AbstractRecordBatch.next():164
          org.apache.drill.exec.record.AbstractRecordBatch.next():119
          org.apache.drill.exec.record.AbstractRecordBatch.next():109
          org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext():51
          org.apache.drill.exec.physical.impl.svremover.RemovingRecordBatch.innerNext():93
          org.apache.drill.exec.record.AbstractRecordBatch.next():164
          org.apache.drill.exec.record.AbstractRecordBatch.next():119
          org.apache.drill.exec.record.AbstractRecordBatch.next():109
          org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext():51
          org.apache.drill.exec.record.AbstractRecordBatch.next():164
          org.apache.drill.exec.record.AbstractRecordBatch.next():119
          org.apache.drill.exec.record.AbstractRecordBatch.next():109
          org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext():51
          org.apache.drill.exec.physical.impl.svremover.RemovingRecordBatch.innerNext():93
          org.apache.drill.exec.record.AbstractRecordBatch.next():164
          org.apache.drill.exec.record.AbstractRecordBatch.next():119
          org.apache.drill.exec.record.AbstractRecordBatch.next():109
          org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext():51
          org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext():133
          org.apache.drill.exec.record.AbstractRecordBatch.next():164
          org.apache.drill.exec.record.AbstractRecordBatch.next():119
          org.apache.drill.exec.record.AbstractRecordBatch.next():109
          org.apache.drill.exec.physical.impl.aggregate.StreamingAggBatch.innerNext():151
          org.apache.drill.exec.record.AbstractRecordBatch.next():164
          org.apache.drill.exec.record.AbstractRecordBatch.next():119
          org.apache.drill.exec.record.AbstractRecordBatch.next():109
          org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext():51
          org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext():133
          org.apache.drill.exec.record.AbstractRecordBatch.next():164
          org.apache.drill.exec.physical.impl.BaseRootExec.next():105
          org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.innerNext():81
          org.apache.drill.exec.physical.impl.BaseRootExec.next():95
          org.apache.drill.exec.work.fragment.FragmentExecutor$1.run():234
          org.apache.drill.exec.work.fragment.FragmentExecutor$1.run():227
          java.security.AccessController.doPrivileged():-2
          javax.security.auth.Subject.doAs():415
          org.apache.hadoop.security.UserGroupInformation.doAs():1595
          org.apache.drill.exec.work.fragment.FragmentExecutor.run():227
          org.apache.drill.common.SelfCleaningRunnable.run():38
          java.util.concurrent.ThreadPoolExecutor.runWorker():1145
          java.util.concurrent.ThreadPoolExecutor$Worker.run():615
          java.lang.Thread.run():744
      
      	at oadd.org.apache.drill.exec.rpc.user.QueryResultHandler.resultArrived(QueryResultHandler.java:123)
      	at oadd.org.apache.drill.exec.rpc.user.UserClient.handle(UserClient.java:368)
      	at oadd.org.apache.drill.exec.rpc.user.UserClient.handle(UserClient.java:90)
      	at oadd.org.apache.drill.exec.rpc.RpcBus$InboundHandler.decode(RpcBus.java:274)
      	at oadd.org.apache.drill.exec.rpc.RpcBus$InboundHandler.decode(RpcBus.java:244)
      	at oadd.io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89)
      	at oadd.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339)
      	at oadd.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324)
      	at oadd.io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:254)
      	at oadd.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339)
      	at oadd.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324)
      	at oadd.io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
      	at oadd.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339)
      	at oadd.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324)
      	at oadd.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:242)
      	at oadd.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339)
      	at oadd.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324)
      	at oadd.io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
      	at oadd.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339)
      	at oadd.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324)
      	at oadd.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:847)
      	at oadd.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
      	at oadd.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
      	at oadd.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
      	at oadd.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
      	at oadd.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
      	at oadd.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)
      	... 1 more
      

      Plan is:

      | 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=[=($0, 0)])
      00-06                SelectionVectorRemover
      00-07                  Sort(sort0=[$1], dir0=[ASC])
      00-08                    Flatten(flattenField=[$1])
      00-09                      Project(id=[$0], str=[$1])
      00-10                        Scan(groupscan=[EasyGroupScan [selectionRoot=maprfs:/drill/testdata/resource-manager/flatten-large-small.json, numFiles=1, columns=[`id`, `str_list`], files=[maprfs:///drill/testdata/resource-manager/flatten-large-small.json]]])
      

      sys.version is:

      | 1.12.0-SNAPSHOT  | c4211d3b545b0d1996b096a8e1ace35376a63977  | Fix for DRILL-5670  | 09.09.2017 @ 14:38:25 PDT  | root@qa-node190.qa.lab  | 11.09.2017 @ 14:27:16 PDT  |
      

      mult drill5447_1

      Attachments

        1. drillbit.log.gz
          5.01 MB
          Robert Hou
        2. 2645d135-4222-d752-2609-c95568ff6e93.sys.drill
          7 kB
          Robert Hou

        Issue Links

          Activity

            People

              Paul.Rogers Paul Rogers
              rhou Robert Hou
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: