Killed connection threads might get their sockets closed twice on shutdown

Bug #1580227 reported by Laurynas Biveinis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.5
Invalid
Undecided
Unassigned
5.6
Fix Released
Medium
Laurynas Biveinis
5.7
Invalid
Undecided
Unassigned

Bug Description

This shows up as a Valgrind warning

==18197== Warning: invalid file descriptor -1 in syscall close()
==18197== at 0x5F6E5BD: ??? (syscall-template.S:84)
==18197== by 0xF95F34: inline_mysql_socket_close (mysql_socket.h:1090)
==18197== by 0xF96AF3: vio_shutdown (viosocket.c:490)
==18197== by 0x7C6BE0: THD::disconnect() (sql_class.cc:2057)
==18197== by 0x637486: close_connection(THD*, unsigned int) (mysqld.cc:2886)
==18197== by 0x7D63E3: do_handle_one_connection(THD*) (sql_connect.cc:1547)
==18197== by 0x7D5E57: handle_one_connection (sql_connect.cc:1444)
==18197== by 0xB98416: pfs_spawn_thread (pfs.cc:1860)
==18197== by 0x5F656F9: start_thread (pthread_create.c:333)
==18197== by 0x6B22B5C: clone (clone.S:109)

on e.g.

rpl.rpl_semi_sync_shutdown_hang 'mix' [ fail ] Found warnings/errors in server log file!
rpl.rpl_gtid_mts_relay_log_recovery_auto_pos_on_off 'mix' w3 [ fail ] Found warnings/errors in server log file!
rpl.rpl_report_port 'mix' w1 [ fail ] Found warnings/errors in server log file!
rpl.rpl_recovery_replicate_same_server_id 'mix' w4 [ fail ] Found warnings/errors in server log file!
rpl.rpl_change_master_crash_safe 'mix' w2 [ fail ] Found warnings/errors in server log file!
rpl.rpl_change_master 'mix' w1 [ fail ] Found warnings/errors in server log file!
rpl.rpl_alter_repository 'mix' w3 [ fail ] Found warnings/errors in server log file!
rpl.rpl_gtid_deployment_step 'mix' w1 [ fail ] Found warnings/errors in server log file!
rpl.rpl_recovery_replicate_same_server_id 'row' w4 [ fail ] Found warnings/errors in server log file!
main.mysql_client_test w4 [ fail ] Found warnings/errors in server log file!
auth_sec.mysql_native_plugin w3 [ fail ] Found warnings/errors in server log file!

The reason is that THD::disconnect is getting called twice, once from server thread-killing thread:
kill_server_threads -> kill_server -> close_connections -> close_connection -> THD::disconnect;
and the second time from the query thread itself, as in the above stacktrace.

Tags: ci valgrind
tags: added: ci valgrind
summary: - Killed connection threads might get their sockets closed twice
+ Killed connection threads might get their sockets closed twice on
+ shutdown
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-3429

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.