Victoria Markman created DRILL-4273:
---------------------------------------

             Summary: If query is cancelled during external sort memory is 
leaked, sort fragment is running forever on a forman node
                 Key: DRILL-4273
                 URL: https://issues.apache.org/jira/browse/DRILL-4273
             Project: Apache Drill
          Issue Type: Bug
          Components: Execution - Flow
    Affects Versions: 1.5.0
            Reporter: Victoria Markman
            Priority: Critical


Query was cancelled during external sort.

Here is what happened:

1. Query got stuck in CANCELLATION_REQUESTED mode: ( queryid = 
2967b65e-ea42-a736-9f5d-3513914ada88 )
2. On a forman node 6:0 (executing merge join) fragment kept running forever 
(see stack below)
{code}
"2967b65e-ea42-a736-9f5d-3513914ada88:frag:6:0" daemon prio=10 
tid=0x0000000001af5800 nid=0x769b runnable [0x00007fa82fc7c000]
   java.lang.Thread.State: RUNNABLE
        at java.lang.Throwable.getStackTraceElement(Native Method)
        at java.lang.Throwable.getOurStackTrace(Throwable.java:827)
        - locked <0x00000006eef95f80> (a java.lang.Exception)
        at java.lang.Throwable.getStackTrace(Throwable.java:816)
        at java.lang.Thread.getStackTrace(Thread.java:1589)
        at org.apache.drill.common.StackTrace.<init>(StackTrace.java:33)
        at 
org.apache.drill.common.HistoricalLog$Event.<init>(HistoricalLog.java:39)
        at 
org.apache.drill.common.HistoricalLog.recordEvent(HistoricalLog.java:95)
        - locked <0x00000006eef95870> (a org.apache.drill.common.HistoricalLog)
        at io.netty.buffer.DrillBuf.<init>(DrillBuf.java:84)
        at 
org.apache.drill.exec.memory.AllocatorManager$BufferLedger.newDrillBuf(AllocatorManager.java:285)
        at 
org.apache.drill.exec.memory.BaseAllocator.bufferWithoutReservation(BaseAllocator.java:222)
        at 
org.apache.drill.exec.memory.BaseAllocator.buffer(BaseAllocator.java:204)
        at 
org.apache.drill.exec.memory.BaseAllocator.buffer(BaseAllocator.java:177)
        at 
org.apache.drill.exec.vector.IntVector.allocateBytes(IntVector.java:201)
        at 
org.apache.drill.exec.vector.IntVector.allocateNew(IntVector.java:183)
        at 
org.apache.drill.exec.vector.NullableIntVector.allocateNew(NullableIntVector.java:216)
        at 
org.apache.drill.exec.vector.AllocationHelper.allocateNew(AllocationHelper.java:56)
        at 
org.apache.drill.exec.physical.impl.join.MergeJoinBatch.allocateBatch(MergeJoinBatch.java:429)
        at 
org.apache.drill.exec.physical.impl.join.MergeJoinBatch.innerNext(MergeJoinBatch.java:172)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:162)
        at 
org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:215)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:119)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:109)
        at 
org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext(AbstractSingleRecordBatch.java:51)
        at 
org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext(ProjectRecordBatch.java:132)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:162)
        at 
org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:215)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:119)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:109)
        at 
org.apache.drill.exec.physical.impl.xsort.ExternalSortBatch.innerNext(ExternalSortBatch.java:295)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:162)
        at 
org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:215)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:119)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:109)
        at 
org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext(AbstractSingleRecordBatch.java:51)
        at 
org.apache.drill.exec.physical.impl.svremover.RemovingRecordBatch.innerNext(RemovingRecordBatch.java:94)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:162)
        at 
org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:215)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:119)
        at 
org.apache.drill.exec.record.RecordIterator.nextBatch(RecordIterator.java:97)
        at 
org.apache.drill.exec.record.RecordIterator.next(RecordIterator.java:183)
        at 
org.apache.drill.exec.record.RecordIterator.prepare(RecordIterator.java:167)
        at 
org.apache.drill.exec.physical.impl.join.JoinStatus.prepare(JoinStatus.java:86)
        at 
org.apache.drill.exec.physical.impl.join.MergeJoinBatch.innerNext(MergeJoinBatch.java:162)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:162)
        at 
org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:215)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:119)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:109)
        at 
org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext(AbstractSingleRecordBatch.java:51)
        at 
org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext(ProjectRecordBatch.java:132)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:162)
        at 
org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:215)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:119)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:109)
        at 
org.apache.drill.exec.physical.impl.xsort.ExternalSortBatch.innerNext(ExternalSortBatch.java:295)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:162)
        at 
org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:215)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:119)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:109)
        at 
org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext(AbstractSingleRecordBatch.java:51)
        at 
org.apache.drill.exec.physical.impl.svremover.RemovingRecordBatch.innerNext(RemovingRecordBatch.java:94)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:162)
        at 
org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:215)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:119)
        at 
org.apache.drill.exec.record.RecordIterator.nextBatch(RecordIterator.java:97)
        at 
org.apache.drill.exec.record.RecordIterator.next(RecordIterator.java:183)
        at 
org.apache.drill.exec.record.RecordIterator.prepare(RecordIterator.java:167)
        at 
org.apache.drill.exec.physical.impl.join.JoinStatus.prepare(JoinStatus.java:86)
        at 
org.apache.drill.exec.physical.impl.join.MergeJoinBatch.innerNext(MergeJoinBatch.java:162)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:162)
        at 
org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:215)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:119)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:109)
        at 
org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext(AbstractSingleRecordBatch.java:51)
        at 
org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext(ProjectRecordBatch.java:132)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:162)
        at 
org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:215)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:119)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:109)
        at 
org.apache.drill.exec.physical.impl.xsort.ExternalSortBatch.innerNext(ExternalSortBatch.java:295)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:162)
        at 
org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:215)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:119)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:109)
        at 
org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext(AbstractSingleRecordBatch.java:51)
        at 
org.apache.drill.exec.physical.impl.svremover.RemovingRecordBatch.innerNext(RemovingRecordBatch.java:94)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:162)
        at 
org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:215)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:119)
        at 
org.apache.drill.exec.record.RecordIterator.nextBatch(RecordIterator.java:97)
        at 
org.apache.drill.exec.record.RecordIterator.next(RecordIterator.java:183)
        at 
org.apache.drill.exec.record.RecordIterator.prepare(RecordIterator.java:167)
        at 
org.apache.drill.exec.physical.impl.join.JoinStatus.prepare(JoinStatus.java:86)
        at 
org.apache.drill.exec.physical.impl.join.MergeJoinBatch.innerNext(MergeJoinBatch.java:162)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:162)
        at 
org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:215)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:119)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:109)
        at 
org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext(AbstractSingleRecordBatch.java:51)
        at 
org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext(ProjectRecordBatch.java:132)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:162)
        at 
org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:215)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:119)
        at 
org.apache.drill.exec.test.generated.HashAggregatorGen53.doWork(HashAggTemplate.java:314)
        at 
org.apache.drill.exec.physical.impl.aggregate.HashAggBatch.innerNext(HashAggBatch.java:133)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:162)
        at 
org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:215)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:119)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:109)
        at 
org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext(AbstractSingleRecordBatch.java:51)
        at 
org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext(ProjectRecordBatch.java:132)
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:162)
        at 
org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:215)
        at 
org.apache.drill.exec.physical.impl.BaseRootExec.next(BaseRootExec.java:104)
        at 
org.apache.drill.exec.physical.impl.SingleSenderCreator$SingleSenderRootExec.innerNext(SingleSenderCreator.java:92)
        at 
org.apache.drill.exec.physical.impl.BaseRootExec.next(BaseRootExec.java:94)
        at 
org.apache.drill.exec.work.fragment.FragmentExecutor$1.run(FragmentExecutor.java:256)
        at 
org.apache.drill.exec.work.fragment.FragmentExecutor$1.run(FragmentExecutor.java:250)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:415)
        at 
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1595)
        at 
org.apache.drill.exec.work.fragment.FragmentExecutor.run(FragmentExecutor.java:250)
        at 
org.apache.drill.common.SelfCleaningRunnable.run(SelfCleaningRunnable.java:38)
        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:745)
{code}

drillbit.log.node_133 (forman node ) had message printed forever:
{code}
2016-01-15 01:33:28,230 [2967b65e-ea42-a736-9f5d-3513914ada88:frag:6:0] WARN  
o.a.d.e.e.ExpressionTreeMaterializer - Unable to find value vector of path 
`ss_sold_date_sk`, returning null instance.
{code}

Log is flooded with this message (node 133):
{code}
[Thu Jan 14 18:00:15] # grep "WARN  o.a.d.e.e.ExpressionTreeMaterializer" 
drillbit.log |wc -l
  409187
{code}

After server was restarted:

1. Query profile was never saved in profiles directory as if it never ran
2. I saved JSON profile off the screen just before that, can be found here: 
2967b65e-ea42-a736-9f5d-3513914ada88.sys.drill
3. drillbit.log showed leak (?) :
This is just a sample, full printout can be found here: after_shutdown.log
{code}
2016-01-15 01:52:41,938 [Drillbit-ShutdownHook#0] WARN  
o.apache.drill.exec.server.Drillbit - Failure on close()
java.lang.RuntimeException: Exception while closing
        at 
org.apache.drill.common.DrillAutoCloseables.closeNoChecked(DrillAutoCloseables.java:46)
 ~[drill-common-1.5.0-SNAPSHOT.jar:1.5.0-SNAPSHOT]
        at 
org.apache.drill.exec.server.BootStrapContext.close(BootStrapContext.java:127) 
~[drill-java-exec-1.5.0-SNAPSHOT.jar:1.5.0-SNAPSHOT]
        at org.apache.drill.common.AutoCloseables.close(AutoCloseables.java:76) 
~[drill-common-1.5.0-SNAPSHOT.jar:1.5.0-SNAPSHOT]
        at org.apache.drill.common.AutoCloseables.close(AutoCloseables.java:64) 
~[drill-common-1.5.0-SNAPSHOT.jar:1.5.0-SNAPSHOT]
        at org.apache.drill.exec.server.Drillbit.close(Drillbit.java:149) 
~[drill-java-exec-1.5.0-SNAPSHOT.jar:1.5.0-SNAPSHOT]
        at 
org.apache.drill.exec.server.Drillbit$ShutdownThread.run(Drillbit.java:243) 
[drill-java-exec-1.5.0-SNAPSHOT.jar:1.5.0-SNAPSHOT]
Caused by: java.lang.IllegalStateException: Allocator[ROOT] closed with 
outstanding child allocators.
Allocator(ROOT) 0/186835008/681513280/51539607552 (res/actual/peak/limit)
  child allocators: 2
    Allocator(query:2967b65e-ea42-a736-9f5d-3513914ada88) 1048576/0/0/268435456 
(res/actual/peak/limit)
      child allocators: 0
      ledgers: 0
      reservations: 0
    Allocator(frag:6:0) 184000000/185786432/210798976/240311229512 
(res/actual/peak/limit)
      child allocators: 33
        Allocator(op:6:0:14:ExternalSort) 20000000/10000000/10073728/38903689 
(res/actual/peak/limit)
          child allocators: 1
            Allocator(op:6:0:14:ExternalSort:copier) 10000000/0/0/20000000 
(res/actual/peak/limit)
              child allocators: 0
              ledgers: 0
              reservations: 0
          ledgers: 0
          reservations: 0
        Allocator(op:6:0:28:ExternalSort) 20000000/10000640/10020480/38903689 
(res/actual/peak/limit)
          child allocators: 1
            Allocator(op:6:0:28:ExternalSort:copier) 10000000/0/0/20000000 
(res/actual/peak/limit)
              child allocators: 0
              ledgers: 0
              reservations: 0
          ledgers: 2
            ledger (allocator: op:6:0:28:ExternalSort), isOwning: true, size: 
128, references: 1
              BufferLedger[438592] holds 1 buffers.
                {DrillBuf[641717], udle identityHashCode == 1405213628, 
identityHashCode == 1547779737}
            ledger (allocator: op:6:0:28:ExternalSort), isOwning: true, size: 
512, references: 2
              BufferLedger[438590] holds 14 buffers.
                {DrillBuf[620704], udle identityHashCode == 1455534019, 
identityHashCode == 1174034356}
                {DrillBuf[641715], udle identityHashCode == 1455534019, 
identityHashCode == 1896324428}
                {DrillBuf[641716], udle identityHashCode == 1455534019, 
identityHashCode == 1896324428}
                {DrillBuf[641710], udle identityHashCode == 1455534019, 
identityHashCode == 1896324428}
                {DrillBuf[641707], udle identityHashCode == 1455534019, 
identityHashCode == 496598622}
                {DrillBuf[641711], udle identityHashCode == 1455534019, 
identityHashCode == 1896324428}
                {DrillBuf[641714], udle identityHashCode == 1455534019, 
identityHashCode == 1896324428}
                {DrillBuf[620708], udle identityHashCode == 1455534019, 
identityHashCode == 496598622}
                {DrillBuf[620696], udle identityHashCode == 1455534019, 
identityHashCode == 1174034356}
{code}

* I was running with Amit's patch for fix DRILL-4190 : 
https://github.com/amithadke/drill/tree/DRILL-4190

* Not sure if this is reproducible case, I will try. Hope there is enough 
information to give it a clue on what happened.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to