Commit 3e377fd3 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-15795 Stack exceeded if pthread_attr_setstacksize(&thr_attr,8196) succeeds

on Linux this pthread_attr_setstacksize() fails with EINVAL
"The stack size is less than PTHREAD_STACK_MIN (16384) bytes".

But on FreeBSD it succeeds and causes a crash later, as 8196 is too little.

Let's keep the stack at its default size in the timer thread.
parent 68391ace
...@@ -263,7 +263,6 @@ int sigwait(sigset_t *setp, int *sigp) ...@@ -263,7 +263,6 @@ int sigwait(sigset_t *setp, int *sigp)
pthread_attr_init(&thr_attr); pthread_attr_init(&thr_attr);
pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_PROCESS); pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_PROCESS);
pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED); pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED);
pthread_attr_setstacksize(&thr_attr,8196);
pthread_create(&sigwait_thread_id, &thr_attr, sigwait_thread, setp); pthread_create(&sigwait_thread_id, &thr_attr, sigwait_thread, setp);
pthread_attr_destroy(&thr_attr); pthread_attr_destroy(&thr_attr);
} }
......
...@@ -114,7 +114,6 @@ void init_thr_alarm(uint max_alarms) ...@@ -114,7 +114,6 @@ void init_thr_alarm(uint max_alarms)
pthread_attr_init(&thr_attr); pthread_attr_init(&thr_attr);
pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_PROCESS); pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_PROCESS);
pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED); pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED);
pthread_attr_setstacksize(&thr_attr,8196);
mysql_thread_create(key_thread_alarm, mysql_thread_create(key_thread_alarm,
&alarm_thread, &thr_attr, alarm_handler, NULL); &alarm_thread, &thr_attr, alarm_handler, NULL);
pthread_attr_destroy(&thr_attr); pthread_attr_destroy(&thr_attr);
......
...@@ -85,7 +85,6 @@ my_bool init_thr_timer(uint alloc_timers) ...@@ -85,7 +85,6 @@ my_bool init_thr_timer(uint alloc_timers)
/* Create a thread to handle timers */ /* Create a thread to handle timers */
pthread_attr_init(&thr_attr); pthread_attr_init(&thr_attr);
pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_PROCESS); pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_PROCESS);
pthread_attr_setstacksize(&thr_attr,8196);
thr_timer_inited= 1; thr_timer_inited= 1;
if (mysql_thread_create(key_thread_timer, &timer_thread, &thr_attr, if (mysql_thread_create(key_thread_timer, &timer_thread, &thr_attr,
timer_handler, NULL)) timer_handler, NULL))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment