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

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_r174279774
  
    --- Diff: core/sql/sqlci/SqlCmd.cpp ---
    @@ -440,25 +461,50 @@ void handleLocalError(ComDiagsArea &diags, SqlciEnv 
*sqlci_env)
       // when HandleCLIError() is called with a error after a CLI call.
       // Soln :10-021203-3433
     
    -  if (diags.getNumber(DgSqlCode::ERROR_)) {
    +  if (diags->getNumber(DgSqlCode::ERROR_)) {
          worstcode = SQL_Error;
       }
    -  else if (diags.getNumber(DgSqlCode::WARNING_)) {
    +  else if (diags->getNumber(DgSqlCode::WARNING_)) {
         worstcode = SQL_Warning;
       }
     
       if (!lastLineWasABlank) log->WriteAllWithoutEOL("");
       lastLineWasABlank = TRUE;
     
       ostringstream errMsg;
    -  NADumpDiags(errMsg, &diags, TRUE/*newline*/, 0, NULL, log->isVerbose(),
    +  NADumpDiags(errMsg, diags, TRUE/*newline*/, 0, NULL, log->isVerbose(),
                   sqlci_env->getTerminalCharset());
     
       errMsg << ends;
     
       log->WriteAllWithoutEOL(errMsg.str().c_str());
     }
     
    +Int64 getRowsAffected(SQLSTMT_ID *stmt)
    +{
    +   Int32 rc;
    +   rc = SQL_EXEC_GetDiagnosticsStmtInfo2(stmt,
    +                           SQLDIAG_ROW_COUNT, &rowsAffected,
    +                           NULL, 0, NULL);
    +   if (rc == 0)
    +      return rowsAffected; 
    +   else
    +      return -1;
    +}
    +
    +Int64 getDiagsCondCount(SQLSTMT_ID *stmt)
    +{
    +   Int32 rc;
    +   Int64 diagsCondCount;
    +   rc = SQL_EXEC_GetDiagnosticsStmtInfo2(stmt,
    +                           SQLDIAG_NUMBER, &diagsCondCount,
    +                           NULL, 0, NULL);
    +   if (rc == 0)
    +      return 0; 
    +   else
    +      return diagsCondCount;
    --- End diff --
    
    This is bizzarre. So if SQL_EXEC_GetDiagnosticsStmtInfo2 returns an error, 
we return diagsCondCount?


> 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