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

ASF GitHub Bot commented on TRAFODION-2853:
-------------------------------------------

Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1470#discussion_r174277858
  
    --- Diff: core/sql/executor/ex_root.cpp ---
    @@ -2659,33 +2663,21 @@ void ex_root_tcb::registerCB(ComDiagsArea 
*&diagsArea)
           return;
         }
       }
    -  NABoolean diagsAreaAllocated = FALSE;
    -
    -  if (diagsArea == NULL)
    -  {
    -     diagsAreaAllocated = TRUE;
    -     diagsArea = ComDiagsArea::allocate(getHeap());
    -  }
    +  Lng32 fromCond = 0;
    +  if (diagsArea != NULL)
    +      fromCond = diagsArea->mark();
       ExSsmpManager *ssmpManager = context->getSsmpManager();
    -  cbServer_ = ssmpManager->getSsmpServer(
    +  cbServer_ = ssmpManager->getSsmpServer((NAHeap *)getHeap(),
                                      cliGlobals->myNodeName(), 
                                      cliGlobals->myCpu(), diagsArea);
       if (cbServer_ == NULL || cbServer_->getControlConnection() == NULL)      
        
       {                
           // We could not get a phandle for the cancel broker.  However,       
        
           // let the query run (on the assumption that it will not need to     
        
           // be canceled) and convert any error conditions to warnings.        
        
    -
    -      // tbd - figure a way retry registration later, as the query 
progresses.             
    -      if (diagsArea != NULL)               
    -         NegateAllErrors(diagsArea);               
    +      diagsArea->negateErrors(fromCond); 
    --- End diff --
    
    The method's caller worries about deallocating the diagsArea in this code 
path, right?


> Memory leak of ComDiagsArea in Context
> --------------------------------------
>
>                 Key: TRAFODION-2853
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-2853
>             Project: Apache Trafodion
>          Issue Type: Bug
>          Components: sql-exe
>    Affects Versions: any
>            Reporter: Selvaganesan Govindarajan
>            Assignee: Selvaganesan Govindarajan
>            Priority: Major
>             Fix For: 2.3
>
>
> There were instances that the executor master process has more than 1 GB of 
> memory  of SQL accounted memory allocated, Looking at the size of allocation 
> by traversing the heap, it was found that  ComDiagsArea is leaking in 
> ContextHeap.
> The heap traversal shows the addresses and the allocated size that were part 
> of context Heap that was leaking
> 0x7fdef4cc69b8 336
>  0x7fdef4cc6bc8 336
>  0x7fdef4cc6d18 336
>  0x7fdef4cc6e68 336
>  0x7fdef4cc6fb8 336
>  0x7fdef4cc71e0 336
>  0x7fdef4cc7330 336
>  0x7fdef4cc7480 336
> The actual address of the objects is 16 bytes from the above address
> (gdb) p *(ComDiagsArea *)0x7fdef4cc69c8 
>  $9 = {
>  <IpcMessageObj> = {
>  _vptr.IpcMessageObj = 0x7fdfbe4bbc50, 
>  s_ =
> { objType_ = 13501, objVersion_ = 0, refCount_ = 1, objLength_ = 0, next_ = 
> 0x0, endianness_ = 1 '\001', spare1_ = 0 '\000', spare2_ = 0, vPtrPad_ = 0x0 }
> }, 
>  members of ComDiagsArea: 
>  collHeapPtr_ = 0x7fdfb18eb128, 
>  errors_ = {
>  <NACollection<ComDiagsArea::DiagsCondition*>> = {
>  <NABasicObject> =
> { _vptr.NABasicObject = 0x7fdfbe4bbf10, h_ = 0x0 }, 
>  members of NACollection<ComDiagsArea::DiagsCondition*>: 
>  maxLength_ = 0, 
>  usedLength_ = 0, 
>  entries_ = 0, 
>  arr_ = 0x0, 
>  usages_ = 0x0, 
>  heap_ = 0x7fdfb18eb128
>  }, 
>  members of NAList<ComDiagsArea::DiagsCondition*>: 
>  first_ = 111111111, 
>  last_ = 111111111, 
>  userIndexCache_ = 111111111, 
>  arrayIndexCache_ = 111111111
>  }, 
>  warnings_ = {
>  ---Type <return> to continue, or q <return> to quit---
>  <NACollection<ComDiagsArea::DiagsCondition*>> = {
>  <NABasicObject> = \{ _vptr.NABasicObject = 0x7fdfbe4bbf10, h_ = 0x0 }
> , 
>  members of NACollection<ComDiagsArea::DiagsCondition*>: 
>  maxLength_ = 0, 
>  usedLength_ = 0, 
>  entries_ = 0, 
>  arr_ = 0x0, 
>  usages_ = 0x0, 
>  heap_ = 0x7fdfb18eb128
>  }, 
>  members of NAList<ComDiagsArea::DiagsCondition*>: 
>  first_ = 111111111, 
>  last_ = 111111111, 
>  userIndexCache_ = 111111111, 
>  arrayIndexCache_ = 111111111
>  }, 
>  newCondition_ = 0x0, 
>  areMore_ = 0, 
>  lengthLimit_ = 30, 
>  rowCount_ = 0, 
>  theSQLFunction_ = 0, 
>  maxDiagsId_ = 0, 
>  avgStreamWaitTime_ = -1, 
>  cost_ = 0, 
>  flags_ = 0, 
>  rowsetRowCountArray_ = 0x0, 
>  fillers_ = '\000' <repeats 59 times>
>  }
> (gdb) (gdb) p *(NAHeap *)0x7fdfb18eb128
>  $10 = {
>  <NAMemory> = {
>  <NABasicObject> =
> { _vptr.NABasicObject = 0x7fdfc1001870, h_ = 0x0 }
> , 
>  members of NAMemory: 
>  name_ = "Heap in ContextCli\000\000", 
>  type_ = NAMemory::DERIVED_MEMORY, 
>  initialSize_ = 524288, 
>  maximumSize_ = 18446744073709551615, 
>  incrementSize_ = 4194304, 
>  parent_ = 0xf18b38, 
>  firstBlk_ = 0x7f3a44f75030, 
>  allocSize_ = 1375405192, 
>  upperLimit_ = 0, 
>  highWaterMark_ = 1447646816, 
>  intervalWaterMark_ = 1447646816, 
>  allocCnt_ = 2837663, 
>  totalSize_ = 1529356096, 
>  blockCnt_ = 381, 
>  thBlockCnt_ = 40, 
>  segGlobals_ = 0x0, 
>  memoryList_ = 0x7fdfb0e7aac0, 
>  lastListEntry_ = 0x7fdeef140608, 
>  nextEntry_ = 0x7fdfb18f12c8, 
>  debugLevel_ = 0, 
>  heapJumpBuf_ = 0xf18a30, 
>  exhaustedMem_ = 0, 
>  errorsMask_ = 0, 
>  heapID_ =
> { heapNum = -1 }
> ,



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to