sysown / proxysql

High-performance MySQL proxy with a GPL license.
http://www.proxysql.com
GNU General Public License v3.0
6.05k stars 983 forks source link

Fix halt on 'PROXYSQL RESUME' command #4757

Open JavierJF opened 6 hours ago

JavierJF commented 6 hours ago

Issue Description

During a RESUME operation, if a 'MySQL_Thread' is bootstrapping listeners (in MySQL_Thread::run_BootstrapListener) and detect that MySQL_Threads_Handler::bootstrapping_listeners is 'false', the thread prematurely shuts down its own bootstrapping flag from 'mypolls' (ProxySQL_Poll::bootstrapping_listeners). Since this thread wont ever bootstrap its corresponding listening sockets, the other working threads will be stalled waiting on it, eventually triggering the watchdog and crashing the instance.

Solution

Simplified the logic using a unique flag for bootstrapping (MySQL_Threads_Handler::bootstrapping_listeners) and introduced a sensible delay to reduce the potential overhead of the worker threads busy-waiting for its time to start their listening sockets, as well as the counterpart overhead on the Admin thread while performing the PAUSE operation.