Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-4825

Valgrind warnings (blocks are still reachable in loss record) on parsing CREATE TABLE with virtual column

    Details

    • Type: Bug
    • Status: Stalled
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 10.0.3, 5.5.32
    • Fix Version/s: 10.0, 5.5
    • Component/s: None
    • Labels:
      None

      Description

      Note: it's a silly test case, so I'm setting priority to Minor and don't think there's any rush to fix it, but still it's weird that this particular statement produces the warnings.

      ==5011== 2,100 bytes in 1 blocks are still reachable in loss record 2 of 3
      ==5011==    at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==5011==    by 0xCCB98E: sf_malloc (safemalloc.c:105)
      ==5011==    by 0xCB667F: my_malloc (my_malloc.c:41)
      ==5011==    by 0xCB68A2: my_realloc (my_malloc.c:92)
      ==5011==    by 0x618C4B: my_yyoverflow(short**, YYSTYPE**, unsigned long*) (sql_parse.cc:5417)
      ==5011==    by 0x7636EC: MYSQLparse(void*) (sql_yacc.cc:18150)
      ==5011==    by 0x61D8A4: parse_sql(THD*, Parser_state*, Object_creation_ctx*) (sql_parse.cc:7644)
      ==5011==    by 0x61985C: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:5724)
      ==5011==    by 0x60D020: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1071)
      ==5011==    by 0x60C230: do_command(THD*) (sql_parse.cc:794)
      ==5011==    by 0x713028: do_handle_one_connection(THD*) (sql_connect.cc:1266)
      ==5011==    by 0x712A0F: handle_one_connection (sql_connect.cc:1181)
      ==5011==    by 0x9614C7: pfs_spawn_thread (pfs.cc:1015)
      ==5011==    by 0x545AE99: start_thread (pthread_create.c:308)
      ==5011==    by 0x619CCBC: clone (clone.S:112)
      

      bzr version-info

      revision-id: sanja@montyprogram.com-20130718081618-6ax63urznfnqmzgt
      revno: 3839
      branch-nick: 5.5
      

      Built with BUILD/compile-pentium-debug-max-no-ndb

      Also reproducible on 10.0. Couldn't reproduce on 5.3.

      5400:bool my_yyoverflow(short **yyss, YYSTYPE **yyvs, ulong *yystacksize)
      5401:{
      5402:  Yacc_state *state= & current_thd->m_parser_state->m_yacc;
      5403:  ulong old_info=0;
      5404:  DBUG_ASSERT(state);
      5405:  if ((uint) *yystacksize >= MY_YACC_MAX)
      5406:    return 1;
      5407:  if (!state->yacc_yyvs)
      5408:    old_info= *yystacksize;
      5409:  *yystacksize= set_zone((*yystacksize)*2,MY_YACC_INIT,MY_YACC_MAX);
      5410:  if (!(state->yacc_yyvs= (uchar*)
      5411:        my_realloc(state->yacc_yyvs,
      5412:                   *yystacksize*sizeof(**yyvs),
      5413:                   MYF(MY_ALLOW_ZERO_PTR | MY_FREE_ON_ERROR))) ||
      5414:      !(state->yacc_yyss= (uchar*)
      5415:        my_realloc(state->yacc_yyss,
      5416:                   *yystacksize*sizeof(**yyss),
      5417:                   MYF(MY_ALLOW_ZERO_PTR | MY_FREE_ON_ERROR))))
      5418:    return 1;
      5419:  if (old_info)
      5420:  {
      5421:    /*
      5422:      Only copy the old stack on the first call to my_yyoverflow(),
      5423:      when replacing a static stack (YYINITDEPTH) by a dynamic stack.
      5424:      For subsequent calls, my_realloc already did preserve the old stack.
      5425:    */
      5426:    memcpy(state->yacc_yyss, *yyss, old_info*sizeof(**yyss));
      5427:    memcpy(state->yacc_yyvs, *yyvs, old_info*sizeof(**yyvs));
      5428:  }
      5429:  *yyss= (short*) state->yacc_yyss;
      5430:  *yyvs= (YYSTYPE*) state->yacc_yyvs;
      5431:  return 0;
      5432:}
      

      Test case:

      CREATE TABLE t1 (f1 INT);
      
      --delimiter |
      
      CREATE TABLE IF NOT EXISTS t1 ( v1 INT AS( COT( 1 % CASE POWER( 1, ROUND( 1, IF( 1, 2, CASE 1 WHEN 2 THEN 3 > CASE 4 WHEN 5 THEN 6 * ( POW( ( LEAST( 7, ( 8 * ( ( ( ( ( CASE 9 WHEN 1 THEN 2 WHEN ( INTERVAL( ( IF( 1, ( 2 AND ( ( NULLIF( 3, 4 ) ) ) ), 5 ) ), 6 ) ) THEN 7 ELSE 8 END ) ) ) ) ) ) ) ), 9 ) ) WHEN 2 THEN 3 ELSE 4 END ELSE 5 END AND 9 ) ) ) WHEN 1 THEN 2 END ) ) PERSISTENT ) ; CREATE TABLE IF NOT EXISTS t2 (i INT) |
      
      --delimiter ;
      
      DROP TABLE t1, t2;
      

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            sanja Oleksandr Byelkin added a comment -

            I thought that lost appeared due to some error, but no.

            Show
            sanja Oleksandr Byelkin added a comment - I thought that lost appeared due to some error, but no.

              People

              • Assignee:
                sanja Oleksandr Byelkin
                Reporter:
                elenst Elena Stepanova
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: