Bug #81609 MySQL Crashing while executing Procedure
Submitted: 26 May 2016 10:42 Modified: 26 Jun 2016 18:43
Reporter: Prasad Wani Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Errors Severity:S1 (Critical)
Version:5.7.12 OS:Ubuntu (14.04.3)
Assigned to: CPU Architecture:Any

[26 May 2016 10:42] Prasad Wani
Description:
Whenever I am calling particular procedure mysql is crashing are restarting by its own. Below is the traces from logs. 

09:36:06 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.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.

key_buffer_size=52428800
read_buffer_size=20971520
max_used_connections=33
max_threads=700
thread_count=32
connection_count=32
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 28732535 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x7f1eb4000ae0
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 = 7f1f2c4f6e68 thread_stack 0x40000
/usr/local/mysql/bin/mysqld(my_print_stacktrace+0x35)[0xf18655]
/usr/local/mysql/bin/mysqld(handle_fatal_signal+0x4a4)[0x79bdf4]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10340)[0x7f24b681a340]
/usr/local/mysql/bin/mysqld(_ZN14Item_func_case7cleanupEv+0x5a)[0x81240a]
/usr/local/mysql/bin/mysqld(_Z13cleanup_itemsP4Item+0x21)[0xcebc31]
/usr/local/mysql/bin/mysqld(_ZN5TABLE16cleanup_gc_itemsEv+0x34)[0xd97004]
/usr/local/mysql/bin/mysqld(_Z19close_thread_tablesP3THD+0x5f)[0xc9f22f]
/usr/local/mysql/bin/mysqld(_Z21mysql_execute_commandP3THDb+0x498)[0xcf07d8]
/usr/local/mysql/bin/mysqld(_ZN13sp_instr_stmt9exec_coreEP3THDPj+0x5d)[0xc7570d]
/usr/local/mysql/bin/mysqld(_ZN12sp_lex_instr23reset_lex_and_exec_coreEP3THDPjb+0x3bc)[0xc75bec]
/usr/local/mysql/bin/mysqld(_ZN12sp_lex_instr29validate_lex_and_execute_coreEP3THDPjb+0xb4)[0xc77e74]
/usr/local/mysql/bin/mysqld(_ZN13sp_instr_stmt7executeEP3THDPj+0x128)[0xc781f8]
/usr/local/mysql/bin/mysqld(_ZN7sp_head7executeEP3THDb+0x805)[0xc70ad5]
/usr/local/mysql/bin/mysqld(_ZN7sp_head17execute_procedureEP3THDP4ListI4ItemE+0x80b)[0xc7169b]
/usr/local/mysql/bin/mysqld(_Z21mysql_execute_commandP3THDb+0x1d39)[0xcf2079]
/usr/local/mysql/bin/mysqld(_Z11mysql_parseP3THDP12Parser_state+0x3ad)[0xcf551d]
/usr/local/mysql/bin/mysqld(_Z16dispatch_commandP3THDPK8COM_DATA19enum_server_command+0x116d)[0xcf66ed]
/usr/local/mysql/bin/mysqld(_Z10do_commandP3THD+0x194)[0xcf71e4]
/usr/local/mysql/bin/mysqld(handle_connection+0x29c)[0xdc1bec]
/usr/local/mysql/bin/mysqld(pfs_spawn_thread+0x174)[0x11cddf4]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x8182)[0x7f24b6812182]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f24b54d847d]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7f1eb41a4ba0): is an invalid pointer
Connection ID (thread ID): 8
Status: NOT_KILLED

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.
2016-05-26T09:36:06.552119Z mysqld_safe Number of processes running now: 0
2016-05-26T09:36:06.553453Z mysqld_safe mysqld restarted
2016-05-26T09:36:06.725155Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2016-05-26T09:36:06.725262Z 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.7.12) starting as process 5640 ...
2016-05-26T09:36:06.731272Z 0 [Note] InnoDB: PUNCH HOLE support not available
2016-05-26T09:36:06.731323Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-05-26T09:36:06.731358Z 0 [Note] InnoDB: Uses event mutexes
2016-05-26T09:36:06.731397Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2016-05-26T09:36:06.731439Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-05-26T09:36:06.731479Z 0 [Note] InnoDB: Using Linux native AIO
2016-05-26T09:36:06.731977Z 0 [Note] InnoDB: Number of pools: 1
2016-05-26T09:36:06.732128Z 0 [Note] InnoDB: Using CPU crc32 instructions
2016-05-26T09:36:06.739999Z 0 [Note] InnoDB: Initializing buffer pool, total size = 20G, instances = 8, chunk size = 128M
2016-05-26T09:36:07.834452Z 0 [Note] InnoDB: Completed initialization of buffer pool
2016-05-26T09:36:07.957843Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2016-05-26T09:36:07.977543Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2016-05-26T09:36:08.061497Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 688816458213
2016-05-26T09:36:08.181132Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 688816675384
2016-05-26T09:36:08.182186Z 0 [Note] InnoDB: Database was not shutdown normally!
2016-05-26T09:36:08.182223Z 0 [Note] InnoDB: Starting crash recovery.
2016-05-26T09:36:08.469774Z 0 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
2016-05-26T09:36:09.885298Z 0 [Note] InnoDB: Apply batch completed
2016-05-26T09:36:10.229954Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2016-05-26T09:36:10.230166Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2016-05-26T09:36:10.230233Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2016-05-26T09:36:10.281679Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2016-05-26T09:36:10.282620Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2016-05-26T09:36:10.282657Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2016-05-26T09:36:10.282942Z 0 [Note] InnoDB: Waiting for purge to start
2016-05-26T09:36:10.333110Z 0 [Note] InnoDB: 5.7.12 started; log sequence number 688816675384
2016-05-26T09:36:10.333259Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2016-05-26T09:36:10.334012Z 0 [Note] Plugin 'FEDERATED' is disabled.
2016-05-26T09:36:10.357318Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2016-05-26T09:36:10.357557Z 0 [Warning] CA certificate ca.pem is self signed.
2016-05-26T09:36:10.358991Z 0 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
2016-05-26T09:36:10.361925Z 0 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
2016-05-26T09:36:10.362034Z 0 [Note] Server socket created on IP: '0.0.0.0'.
2016-05-26T09:36:10.541997Z 0 [Note] Event Scheduler: Loaded 0 events
2016-05-26T09:36:10.542187Z 0 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.7.12'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)

How to repeat:
Every time I call procedure call `tc_syncstock`(787722,3838,',','2016-05-26 10:59:13',@v_status); MySQL Crashes.
[26 May 2016 10:44] Prasad Wani
Below is the my.cnf (System is AWS r3.2xlarge)

[client]
port		= 3306
socket		= /var/run/mysqld/mysqld.sock

[mysqld_safe]
pid-file	= /var/run/mysqld/mysqld.pid
socket		= /var/run/mysqld/mysqld.sock
nice		= 0

[mysqld]
user		= mysql
pid-file	= /var/run/mysqld/mysqld.pid
socket		= /var/run/mysqld/mysqld.sock
port		= 3306
basedir		= /usr/local/mysql
datadir		= /var/lib/mysql
tmpdir		= /tmp
lc-messages-dir	= /usr/share/mysql
key_buffer_size =50M
table_open_cache=4000

#MySQL Global Variables
max_connections 		= 1500
sort_buffer_size 		= 20M
read_buffer_size 		= 20M
read_rnd_buffer_size 		= 8M
myisam_sort_buffer_size 	= 16M
thread_cache_size 		= 400
#query_cache_size 		= 50M
open-files-limit 		= 30000
expire_logs_days    	   	= 30

#InnoDB Engine Fine Tunning
innodb_file_per_table 		= 1
innodb_buffer_pool_size 	= 20G
innodb_log_file_size 		= 1024M
innodb_log_buffer_size 		= 300M
innodb_flush_log_at_trx_commit 	= 0
innodb_lock_wait_timeout 	= 50
innodb_flush_method 		= O_DIRECT

explicit_defaults_for_timestamp

bind-address	= 0.0.0.0

log-error	= /var/log/mysql/error.log

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

!includedir /etc/mysql/conf.d/
[26 May 2016 18:43] Miguel Solorzano
Thank you for the bug report. We need a repeatable test case of that particular stored procedure otherwise we won't able to repeat the issue. Thanks.
[27 Jun 2016 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".