You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Paul Rogers (JIRA)" <ji...@apache.org> on 2017/09/24 04:53:00 UTC

[jira] [Commented] (DRILL-5805) External Sort runs out of memory

    [ https://issues.apache.org/jira/browse/DRILL-5805?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16178078#comment-16178078 ] 

Paul Rogers commented on DRILL-5805:
------------------------------------

The log clearly provides the reason for the error:
{code}
Insufficient memory to merge two batches. Incoming batch size: 1,073,819,648, available memory: 429,496,729
2017-09-14 00:25:09,160 [2645d135-4222-d752-2609-c95568ff6e93:frag:0:0] INFO  o.a.d.e.p.i.x.m.BufferedBatches - User Error Occurred: Unable to allocate sv2 buffer (Unable to allocate sv2 buffer)
{code}

The sort is still unable to fit a 1 GB batch into a half GB of memory.

This problem will be addressed by the batch size limitation (AKA "memory fragmentation") project.

The log also has hash agg OOM errors:

{code}
Caused by: org.apache.drill.exec.exception.OutOfMemoryException: HT was: 291897344 OOM at Second Phase. Partitions: 8. 
	at org.apache.drill.exec.test.generated.HashAggregatorGen12869.checkGroupAndAggrValues(HashAggTemplate.java:1188) ~[na:na]
	at org.apache.drill.exec.test.generated.HashAggregatorGen12869.doWork(HashAggTemplate.java:552) ~[na:na]
	at org.apache.drill.exec.physical.impl.aggregate.HashAggBatch.innerNext(HashAggBatch.java:168) ~[drill-java-exec-1.12.0-SNAPSHOT.jar:1.12.0-SNAPSHOT]
{code}

Also

{code}
Caused by: org.apache.drill.exec.exception.OutOfMemoryException: Unable to allocate buffer of size 4194304 (rounded from 3276800) due to memory limit. Current allocation: 312868864
	at org.apache.drill.exec.memory.BaseAllocator.buffer(BaseAllocator.java:238) ~[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 org.apache.drill.exec.vector.VarCharVector.allocateNew(VarCharVector.java:402) ~[vector-1.12.0-SNAPSHOT.jar:1.12.0-SNAPSHOT]
	at org.apache.drill.exec.vector.NullableVarCharVector.allocateNew(NullableVarCharVector.java:237) ~[vector-1.12.0-SNAPSHOT.jar:1.12.0-SNAPSHOT]
	at org.apache.drill.exec.test.generated.HashTableGen18869$BatchHolder.<init>(HashTableTemplate.java:146) ~[na:na]
{code}

> External Sort runs out of memory
> --------------------------------
>
>                 Key: DRILL-5805
>                 URL: https://issues.apache.org/jira/browse/DRILL-5805
>             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: 2645d135-4222-d752-2609-c95568ff6e93.sys.drill, drillbit.log.gz
>
>
> Query is:
> {noformat}
> 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;
> {noformat}
> Error is:
> {noformat}
> 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
> {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=[=($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]]])
> {noformat}
> sys.version is:
> {noformat}
> | 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  |
> {noformat}
> mult drill5447_1



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)