[MDEV-4566] MariaDB crashed when using thread pool Created: 2013-05-23  Updated: 2013-05-27  Resolved: 2013-05-23

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.0.2
Fix Version/s: 10.0.3

Type: Bug Priority: Major
Reporter: Louis Hust Assignee: Vladislav Vaintroub
Resolution: Fixed Votes: 0
Labels: threadpool
Environment:

ubuntu 12.04 (64bit) , 10.0.2-MariaDB-debug


Attachments: File patch.diff    

 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.



 Comments   
Comment by Vladislav Vaintroub [ 2013-05-23 ]

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]

Comment by Louis Hust [ 2013-05-23 ]

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.

Comment by Louis Hust [ 2013-05-23 ]

@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?

Comment by Vladislav Vaintroub [ 2013-05-23 ]

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.

Comment by Louis Hust [ 2013-05-24 ]

@Vladislav Vaintroub

Thanks for your reply.

Generated at Thu Feb 08 06:57:24 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.