Bug #89607 MySQL crash in debug, PFS thread not handling singals.
Submitted: 9 Feb 13:47 Modified: 12 Feb 12:42
Reporter: Robert Golebiowski (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S2 (Serious)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any
Tags: Contribution

[9 Feb 13:47] Robert Golebiowski
Description:
This bug addresses two problems:

1) There is an assertion failure in debug mode - THE_KEY_mysys_initialized == TRUE
2) PFS thread has no signal mask assigned, while signal handling thread is not yet started.

How to repeat:
1) is a race conditions. 
2) you need to sent SIGTERM after starting PFS and before starting signal handling thread (start_signal_handler)

Suggested fix:
Resolutions:

1) Moved calling set_my_sys_thread_var before signaling conditional variable
THR_COND_threads. This is variable on which my_thread_global_end is waiting.
After it is signalled THR_KEY_mysys_initialized is set to FALSE in my_thread_global_end. There is a debug assertion that THE_KEY_mysys_initialized == TRUE in set_my_sys_thread_var.
2) Moved my_init_signals, which sets signal mask to block all handleable kill signals - which are later serviced by signal_hand thread. my_init_singals was moved before PFS initialization. PFS thread can be affected by "handleable kill" signals unless they have singal mask set
[9 Feb 13:48] Robert Golebiowski
Patch

Attachment: patch (application/octet-stream, text), 1.68 KiB.

[12 Feb 12:42] Umesh Shastry
Hello Robert,

Thank you for the report and contribution.
Please ensure to re-send the patch via "Contribution" tab. Otherwise we would not be able to accept it. Thank you!

Thanks,
Umesh
[12 Feb 14:11] Robert Golebiowski
Fix for Bug#89607

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: patch (application/octet-stream, text), 1.68 KiB.