Uploaded image for project: 'MariaDB MaxScale'
  1. MariaDB MaxScale
  2. MXS-2917

qc_sqlite leaks memory with complex CREATE TABLE query

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 2.3.17
    • 2.3.18, 2.4.8
    • qc_sqlite
    • None

    Description

      The following SQL causes the query classifier to leak memory whenever the query is parsed:

      CREATE TABLE IF NOT EXISTS X ( f1 DOUBLE, f2 DOUBLE, f3 DOUBLE NOT NULL, f4 DOUBLE NOT NULL, v1 DOUBLE AS ( ( IF( f2, f1, ( ( ( IF( f1, f3, f1 ) ) ) OR ( ( f4 != ( ( IFNULL( ( RAND( f3 ) ), ( ( ( ( ROUND( f3, f2 ) ) IS NULL ) ) OR ( f1 ) ) ) ) <> ( IF( ( ( ( NULLIF( f2, f2 ) ) ) AND ( f1 ) ), ( ( ( f3 ) AND ( f3 ) ) DIV f4 ), f3 ) ) ) ) ) ) ) ) ) PERSISTENT , v2 DOUBLE AS ( ( ISNULL( ( ( f3 ) AND ( ( INTERVAL( ( SIGN( f3 ) ), ( ( f4 ) AND ( f3 ) ) ) ) ) ) ) ) ) PERSISTENT , v3 DOUBLE AS ( ( ( f4 ) AND ( ( ( f4 ) OR ( ( f4 / f1 ) ) ) ) ) ) PERSISTENT , v4 DOUBLE AS ( ( ( ( f3 - f1 ) ) AND ( ( NOT ( ( ASIN( f1 ) ) ) ) ) ) ) PERSISTENT   )  /* QUERY_NO 4 CON_ID 4152 */ ;
      

      Valgrind reports the following:

      sending command leak_check definiteleak any to pid 22100
      ==22100== Thread 3:
      ==22100== 256 (80 direct, 176 indirect) bytes in 1 blocks are definitely lost in loss record 1,091 of 1,491
      ==22100==    at 0x483880B: malloc (vg_replace_malloc.c:309)
      ==22100==    by 0x6A9BF89: sqlite3MemMalloc (sqlite3.c:18650)
      ==22100==    by 0x6A9C551: sqlite3Malloc (sqlite3.c:22353)
      ==22100==    by 0x6A9CC13: dbMallocRawFinish (sqlite3.c:22676)
      ==22100==    by 0x6A9CD8E: sqlite3DbMallocRawNN (sqlite3.c:22744)
      ==22100==    by 0x6AE0321: sqlite3ExprAlloc (sqlite3.c:87168)
      ==22100==    by 0x6AE075C: sqlite3ExprAnd (sqlite3.c:87314)
      ==22100==    by 0x6AE059D: sqlite3PExpr (sqlite3.c:87258)
      ==22100==    by 0x6B22747: spanBinaryExpr (sqlite3.c:128536)
      ==22100==    by 0x6B25D51: yy_reduce (sqlite3.c:132821)
      ==22100==    by 0x6B29143: sqlite3Parser (sqlite3.c:134363)
      ==22100==    by 0x6B2A6F9: sqlite3RunParser (sqlite3.c:135758)
      ==22100== 
      ==22100== LEAK SUMMARY:
      ==22100==    definitely lost: 80 bytes in 1 blocks
      ==22100==    indirectly lost: 176 bytes in 2 blocks
      ==22100==      possibly lost: 5,675,668 bytes in 6,490 blocks
      ==22100==    still reachable: 708,736 bytes in 7,023 blocks
      ==22100==         suppressed: 0 bytes in 0 blocks
      ==22100== Reachable blocks (those to which a pointer was found) are not shown.
      ==22100== To see them, add 'reachable any' args to leak_check
      ==22100== 
      

      Attachments

        Issue Links

          Activity

            People

              johan.wikman Johan Wikman
              markus makela markus makela
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.