Bug #81193 MySQL crashed when make connections from daemon plugin
Submitted: 25 Apr 2016 11:56 Modified: 24 May 2017 16:03
Reporter: Fangxin Flou (OCA) Email Updates:
Status: No Feedback Impact on me:
Category:MySQL Server: Connection Handling Severity:S3 (Non-critical)
Version:5.5.x OS:Any
Assigned to: CPU Architecture:Any

[25 Apr 2016 11:56] Fangxin Flou
A succesful mysql_real_connect in daemon plugin thread get the following errors and mysql creashed.

160425 19:40:17 [Note] /usr/local/onesql5542/bin/mysqld: ready for connections.
Version: '5.5.42'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
11:42:48 UTC - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 338498 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0 thread_stack 0x40000
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
160425 19:42:48 mysqld_safe Number of processes running now: 0

How to repeat:
make a sucessful mysql_real_connect in daemon plugin thread.

Suggested fix:
in mysys/thr_alarm.c

my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)

orginal code:

  alarm_data->thread=    current_my_thread_var->pthread_self;
  alarm_data->thread_id= current_my_thread_var->id;
  queue_insert_safe(&alarm_queue, (uchar*) alarm_data);

changed to:

  if (current_my_thread_var)
  alarm_data->thread=    current_my_thread_var->pthread_self;
  alarm_data->thread_id= current_my_thread_var->id;
  queue_insert_safe(&alarm_queue, (uchar*) alarm_data);

Threads from daemon thread does not have current_my_thread_var
[24 Apr 2017 16:03] MySQL Verification Team

I need the answers to several questions , before I can conclude whether it is a bug or not.

* How did you manage to cause zero pointer on thread in the thr_alarm()
* Are you using our build of the server
* Are you using our mysql CLI or our libmysqlclient libraries 
* If not, can you try our binaries
* I have tried to crash 5.5 in daemon plugin, but did not succeed. How did you manage to do it ???  Also, what plugin exactly (name, version & release) are you using and is it a match to the server ??
Thank you very much in advance.
[25 May 2017 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".