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

COM_STMT_SEND_LONG_DATA lead to crash

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 2.2.5
    • Component/s: readwritesplit
    • Labels:
      None
    • Environment:
      make with -DCMAKE_BUILD_TYPE=Debug

      Description

      bt:
      (gdb) bt
      #0 0x00007f96004896ab in raise () from /lib64/libpthread.so.0
      #1 0x00007f96009ed472 in session_store_stmt (session=0x7f95c8012580, buf=0x7f95c8025450, server=0x1accbf0) at /home/xiangzhong.wxd/gitlab/MaxScale/server/core/session.cc:953
      #2 0x00007f95fbf7f105 in handle_got_target (inst=0x1af9700, rses=0x7f95c8023640, querybuf=0x7f95c8025450, target=std::tr1::shared_ptr (count 2) 0x7f95c8024360, store=true)
      at /home/xiangzhong.wxd/gitlab/MaxScale/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc:1168
      #3 0x00007f95fbf7bba4 in route_single_stmt (inst=0x1af9700, rses=0x7f95c8023640, querybuf=0x7f95c8025450, info=...)
      at /home/xiangzhong.wxd/gitlab/MaxScale/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc:264
      #4 0x00007f95fbf729b9 in routeQuery (instance=0x1af9700, router_session=0x7f95c8023640, querybuf=0x7f95c8025450)
      at /home/xiangzhong.wxd/gitlab/MaxScale/server/modules/routing/readwritesplit/readwritesplit.cc:964
      #5 0x00007f95fa6b46ba in route_by_statement (session=0x7f95c8012580, capabilities=4294967431, p_readbuf=0x7f95d35fa560)
      at /home/xiangzhong.wxd/gitlab/MaxScale/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc:1564
      #6 0x00007f95fa6b2d84 in gw_read_finish_processing (dcb=0x7f95c8013e90, read_buffer=0x7f95c80141b0, capabilities=4294967431)
      at /home/xiangzhong.wxd/gitlab/MaxScale/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc:1063
      #7 0x00007f95fa6b2b25 in gw_read_normal_data (dcb=0x7f95c8013e90, read_buffer=0x7f95c80141b0, nbytes_read=179)
      at /home/xiangzhong.wxd/gitlab/MaxScale/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc:1005
      #8 0x00007f95fa6b1225 in gw_read_client_event (dcb=0x7f95c8013e90) at /home/xiangzhong.wxd/gitlab/MaxScale/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc:516
      #9 0x00007f960099ceb7 in dcb_process_poll_events (dcb=0x7f95c8013e90, events=5) at /home/xiangzhong.wxd/gitlab/MaxScale/server/core/dcb.cc:3145
      #10 0x00007f960099d278 in dcb_handler (dcb=0x7f95c8013e90, events=5) at /home/xiangzhong.wxd/gitlab/MaxScale/server/core/dcb.cc:3230
      #11 0x00007f960099d335 in dcb_poll_handler (data=0x7f95c8013e90, thread_id=8, events=5) at /home/xiangzhong.wxd/gitlab/MaxScale/server/core/dcb.cc:3266
      #12 0x00007f96009fe9f5 in maxscale::Worker::poll_waitevents (this=0x1ac9f70) at /home/xiangzhong.wxd/gitlab/MaxScale/server/core/worker.cc:1205
      #13 0x00007f96009fdb88 in maxscale::Worker::run (this=0x1ac9f70) at /home/xiangzhong.wxd/gitlab/MaxScale/server/core/worker.cc:885
      #14 0x00007f96009fe60c in maxscale::Worker::thread_main (pArg=0x1ac9f70) at /home/xiangzhong.wxd/gitlab/MaxScale/server/core/worker.cc:1106
      #15 0x00007f9600481aa1 in start_thread () from /lib64/libpthread.so.0
      #16 0x00007f95fe64c93d in clone () from /lib64/libc.so.6

      case :

      static int test_long_data(MYSQL *conn, int sqlsize)
      {
          int data1size = sqlsize/2;
       
          char * data1 = (char*) malloc(data1size);
          memset(data1,97,data1size);
          char * data3 = (char*) malloc(sqlsize);
          memset(data3,99,sqlsize);
       
          //printf("data size:%d, %d\n", sqlsize, sizeof(data1));
          MYSQL_STMT *stmt;
          stmt = mysql_stmt_init(conn);
          int        rc, int_data;
          MYSQL_RES  *result;
          MYSQL_BIND my_bind[1];
          char query[MAX_TEST_QUERY_LENGTH];
       
          rc= mysql_autocommit(conn, TRUE);
       
          if(NULL == stmt){
              fprintf(stderr,"%s",mysql_error(conn));
              return 0;
          }
          if (mysql_stmt_prepare(stmt, "select ?", strlen("select ?")) != 0) {
              print_stmt_error(stmt,"stmt prepare fail");
              return 0;
          }
          /* Always bzero all members of bind parameter */
          bzero((char*) my_bind, sizeof(my_bind));
       
          my_bind[0].buffer= (void *)&int_data;
          my_bind[0].buffer_type= MYSQL_TYPE_STRING;
       
          if (mysql_stmt_bind_param(stmt, my_bind) != 0) {
              print_stmt_error(stmt,"bind param error");
              return 0;
          }
       
          /* supply data in pieces */
          if(mysql_stmt_send_long_data(stmt, 0, data1, data1size) != 0){
              print_stmt_error(stmt,"send long data1 failed");
              return 0;
          }
          if(mysql_stmt_send_long_data(stmt, 0, data3, sqlsize) != 0){
              print_stmt_error(stmt, "send long data3 failed");
              return 0;
          }
       
          /* execute */
          if(mysql_stmt_execute(stmt) != 0){
              print_stmt_error(stmt,"execute prepare stmt failed");
              return 0;
          }
          /* get the result */
          result= mysql_store_result(conn);
          mysql_free_result(result);
          mysql_stmt_close(stmt);
          free(data1);
          free(data3);
          return 1;
      }
      

        Attachments

          Activity

            People

            Assignee:
            markus makela markus makela
            Reporter:
            xzh xiangzhong
            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.