3112 Dmitry Shulga 2010-11-10 [merge]
Auto-merge from 5.1-bugteam for bug#57386.
modified:
sql/item_func.cc
3111 Davi Arnaut 2010-11-09
Bug#58080: Crash on failure to create a thread to handle a user connection
The problem was that the scheduler function used to handle a
new user connection could use the ER() macro without having a
THD object bound to the current thread. The crash would happen
whenever the function failed to create a new thread to handle a
user connection. Thread creation can fail due to lack or limit
of available resources.
The solution is to simply use the ER_THD() macro instead and pass
to it the THD object which would be bound to the connection.
Fix was tested manually. In a test case, it is too cumbersome to
inject a error in this context.
@ sql/mysqld.cc
Use ER_THD and pass the object.
modified:
sql/mysqld.cc
=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc 2010-10-14 01:54:07 +0000
+++ b/sql/item_func.cc 2010-11-10 05:58:50 +0000
@@ -178,7 +178,14 @@ Item_func::fix_fields(THD *thd, Item **r
used_tables_cache= not_null_tables_cache= 0;
const_item_cache=1;
- if (check_stack_overrun(thd, STACK_MIN_SIZE, buff))
+ /*
+ Use stack limit of STACK_MIN_SIZE * 2 since
+ on some platforms a recursive call to fix_fields
+ requires more than STACK_MIN_SIZE bytes (e.g. for
+ MIPS, it takes about 22kB to make one recursive
+ call to Item_func::fix_fields())
+ */
+ if (check_stack_overrun(thd, STACK_MIN_SIZE * 2, buff))
return TRUE; // Fatal error if flag is set!
if (arg_count)
{ // Print purify happy
Attachment: [text/bzr-bundle] bzr/dmitry.shulga@oracle.com-20101110055850-tj7pq3la5ea2podn.bundle
| Thread |
|---|
| • bzr push into mysql-5.5-bugteam branch (Dmitry.Shulga:3111 to 3112) Bug#57386 | Dmitry Shulga | 10 Nov |