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

MariaDB crashed when using thread pool

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.0.2
    • 10.0.3
    • None
    • ubuntu 12.04 (64bit) , 10.0.2-MariaDB-debug

    Description

      When using thread pool and execute 'select sleep(10);', the server crashed.

      [How to repeat]

      In the my.cnf, set thread_pool_handling=pool-of-threads

      Then connect to the server:
      MariaDB [(none)]> select sleep(10000);

      Then the server crashed with the information below:

      mysqld: /home/loushuai/src/mariadb/10.0/sql/threadpool_unix.cc:1283: void tp_wait_begin(THD*, int): Assertion `!connection->waiting' failed.

      Program received signal SIGABRT, Aborted.

      [Reason]
      repeat to enter the tp_wait_begin() in
      longlong Item_func_sleep::val_int() function in file sql/item_func.cc

      [How to fix]
      see the patch in attachment.

      Attachments

        Activity

          wlad Vladislav Vaintroub added a comment - - edited

          Reproducible for sleeps longer than 5 seconds
          (Interruptible_wait::wait() periodically checks if connection is alive, and assertion is triggered in such a check, in vio_is_connected(), in vio_io_wait() with timeout 0.

          sql/threadpool_unix.cc:1271(tp_wait_begin(THD*, int))[0x7aeb56]
          sql/sql_class.cc:4159(thd_wait_begin)[0x5e82f6]
          sql/scheduler.cc:68(scheduler_wait_net_begin)[0x728ecd]
          vio/viosocket.c:967(vio_io_wait)[0xd80b7c]
          vio/viosocket.c:1194(vio_is_connected)[0xd80e63]
          sql/sql_class.h:2796(THD::is_connected())[0x5ed3ba]
          sql/item_func.cc:3884(Interruptible_wait::wait(st_mysql_cond*, st_mysql_mutex*))[0x84f9d4]
          sql/item_func.cc:4398(Item_func_sleep::val_int())[0x850df5]
          sql/item.cc:6379(Item::send(Protocol*, String*))[0x806c44]
          sql/protocol.cc:900(Protocol::send_result_set_row(List<Item>*))[0x57ef41]
          sql/sql_class.cc:2416(select_send::send_data(List<Item>&))[0x5e2e2c]

          wlad Vladislav Vaintroub added a comment - - edited Reproducible for sleeps longer than 5 seconds (Interruptible_wait::wait() periodically checks if connection is alive, and assertion is triggered in such a check, in vio_is_connected(), in vio_io_wait() with timeout 0. sql/threadpool_unix.cc:1271(tp_wait_begin(THD*, int)) [0x7aeb56] sql/sql_class.cc:4159(thd_wait_begin) [0x5e82f6] sql/scheduler.cc:68(scheduler_wait_net_begin) [0x728ecd] vio/viosocket.c:967(vio_io_wait) [0xd80b7c] vio/viosocket.c:1194(vio_is_connected) [0xd80e63] sql/sql_class.h:2796(THD::is_connected()) [0x5ed3ba] sql/item_func.cc:3884(Interruptible_wait::wait(st_mysql_cond*, st_mysql_mutex*)) [0x84f9d4] sql/item_func.cc:4398(Item_func_sleep::val_int()) [0x850df5] sql/item.cc:6379(Item::send(Protocol*, String*)) [0x806c44] sql/protocol.cc:900(Protocol::send_result_set_row(List<Item>*)) [0x57ef41] sql/sql_class.cc:2416(select_send::send_data(List<Item>&)) [0x5e2e2c]
          louis hust Louis Hust added a comment -

          Yes, in the patch i commited, i just remove the tp_wait_begin and tp_wait_end. Although this works, but it can not affect
          the thread pool immediately to wake up thread or create a new worker thread.

          louis hust Louis Hust added a comment - Yes, in the patch i commited, i just remove the tp_wait_begin and tp_wait_end. Although this works, but it can not affect the thread pool immediately to wake up thread or create a new worker thread.
          louis hust Louis Hust added a comment -

          @Vladislav Vaintroub

          hi Vladislav Vaintroub,

          I see that you fixed the bug, i want to know the patch have been comitted to the 10.0 develop source tree? Or need be reviewed by
          other people?

          louis hust Louis Hust added a comment - @Vladislav Vaintroub hi Vladislav Vaintroub, I see that you fixed the bug, i want to know the patch have been comitted to the 10.0 develop source tree? Or need be reviewed by other people?

          It is in the 10.0 tree http://bazaar.launchpad.net/~maria-captains/maria/10.0/revision/3752
          I did not ask for review because , frankly, the fix was trivial.

          wlad Vladislav Vaintroub added a comment - It is in the 10.0 tree http://bazaar.launchpad.net/~maria-captains/maria/10.0/revision/3752 I did not ask for review because , frankly, the fix was trivial.
          louis hust Louis Hust added a comment -

          @Vladislav Vaintroub

          Thanks for your reply.

          louis hust Louis Hust added a comment - @Vladislav Vaintroub Thanks for your reply.

          People

            wlad Vladislav Vaintroub
            louis hust Louis Hust
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.