MariaDB server is a community developed fork of MySQL server. Started by core members of the original MySQL team, MariaDB actively works with outside developers to deliver the most featureful, stable, and sanely licensed open SQL server in the industry.
Find a file
Brandon Nesterenko 952ab9a596 MDEV-30260: Slave crashed:reload_acl_and_cache during shutdown
The signal handler thread can use various different runtime
resources when processing a SIGHUP (e.g. master-info information)
due to calling into reload_acl_and_cache(). Currently, the shutdown
process waits for the termination of the signal thread after
performing cleanup. However, this could cause resources actively
used by the signal handler to be freed while reload_acl_and_cache()
is processing.

The specific resource that caused MDEV-30260 is a race condition for
the hostname_cache, such that mysqld would delete it in
clean_up()::hostname_cache_free(), before the signal handler would
use it in reload_acl_and_cache()::hostname_cache_refresh().

Another similar resource is the active_mi/master_info_index. There
was a race between its deletion by the main thread in end_slave(),
and their usage by the Signal Handler as a part of
Master_info_index::flush_all_relay_logs.read(active_mi) in
reload_acl_and_cache().

This patch fixes these race conditions by relocating where server
shutdown waits for the signal handler to die until after
server-level threads have been killed (i.e., as a last step of
close_connections()). With respect to the hostname_cache, active_mi
and master_info_cache, this ensures that they cannot be destroyed
while the signal handler is still active, and potentially using
them.

Additionally:

 1) This requires that Events memory is still in place for SIGHUP
handling's mysql_print_status(). So event deinitialization is moved
into clean_up(), but the event scheduler still needs to be stopped
in close_connections() at the same spot.

 2) The function kill_server_thread is no longer used, so it is
deleted

 3) The timeout to wait for the death of the signal thread was not
consistent with the comment. The comment mentioned up to 10 seconds,
whereas it was actually 0.01s. The code has been fixed to wait up to
10 seconds.

 4) A warning has been added if the signal handler thread fails to
exit in time.

 5) Added pthread_join() to end of wait_for_signal_thread_to_end()
if it hadn't ended in 10s with a warning. Note this also removes
the pthread_detached attribute from the signal_thread to allow
for the pthread_join().

Reviewed By:
===========
Vladislav Vaintroub <wlad@mariadb.com>
Andrei Elkin <andrei.elkin@mariadb.com>
2024-04-09 14:25:13 -06:00
BUILD Merge branch '10.4' into 10.5 2023-12-02 01:02:50 +01:00
client Fixed memory leaks in embedded server and mysqltest 2024-04-05 12:40:49 +02:00
cmake Revert "MDEV-33636: RPM caps is on mariadbd exe" 2024-03-27 13:36:31 +11:00
dbug Merge branch '10.4' into 10.5 2023-01-27 13:54:14 +01:00
debian Revert "MDEV-33636: RPM caps is on mariadbd exe" 2024-03-27 13:36:31 +11:00
Docs Merge 10.4 into 10.5 2022-09-26 13:34:38 +03:00
extra MDEV-33482: Optimize WolfSSL for improved performance 2024-02-18 01:10:41 +01:00
include Merge 10.4 into 10.5 2024-03-11 10:08:20 +02:00
libmariadb@1d3fd5818a update C/C 2024-04-08 19:13:14 +02:00
libmysqld Fixed memory leaks in embedded server and mysqltest 2024-04-05 12:40:49 +02:00
libservices MDEV-33277 In-place upgrade causes invalid AUTO_INCREMENT values 2024-02-08 10:35:45 +02:00
man Properly introduce wsrep_sst_backup script in project packaging 2024-02-13 12:03:55 +00:00
mysql-test MDEV-30260: Slave crashed:reload_acl_and_cache during shutdown 2024-04-09 14:25:13 -06:00
mysys Merge 10.4 into 10.5 2024-03-11 10:08:20 +02:00
mysys_ssl Merge branch '10.4' into 10.5 2023-08-01 11:52:13 +02:00
plugin plugins.test_sql_service --valgrind 2024-03-27 16:14:55 +01:00
randgen/conf
scripts Disable error messages in mysql-install-db for not writable log directory 2024-02-20 13:48:20 +02:00
sql MDEV-30260: Slave crashed:reload_acl_and_cache during shutdown 2024-04-09 14:25:13 -06:00
sql-bench Merge 10.4 into 10.5 2020-07-02 09:41:44 +03:00
sql-common Merge branch '10.4' into 10.5 2023-12-02 01:02:50 +01:00
storage MDEV-33731 Only iterate over m_locked_partitions in update_next_auto_inc_val() 2024-04-09 09:24:48 +10:00
strings Merge branch '10.4' into 10.5 2024-01-31 17:32:53 +01:00
support-files MDEV-33301 memlock with systemd still not working 2024-03-27 13:36:31 +11:00
tests MDEV-33478: Tests massively fail with clang-18 -fsanitize=memory 2024-03-18 16:01:29 +02:00
tpool MDEV-33840 tpool : switch off maintenance timer when not needed. 2024-04-09 08:31:32 +02:00
unittest Merge branch '10.4' into 10.5 2023-12-02 01:02:50 +01:00
vio Merge branch '10.4' into 10.5 2022-10-26 15:26:06 +02:00
win Merge branch '10.4' into 10.5 2024-01-31 17:32:53 +01:00
wsrep-lib@dfc4bdb8a5 galera: wsrep-lib submodule update 2024-04-09 12:21:53 +02:00
zlib Merge branch 'zlib v1.3' into 10.4 2023-10-18 20:39:48 +02:00
.clang-format Merge 10.4 into 10.5 2019-12-27 21:17:16 +02:00
.gitattributes MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
.gitignore Merge commit '10.4' into 10.5 2023-07-20 11:54:52 +02:00
.gitlab-ci.yml Merge commit '10.4' into 10.5 2023-07-20 11:54:52 +02:00
.gitmodules Merge remote-tracking branch '10.4' into 10.5 2023-03-31 21:32:41 +02:00
appveyor.yml Fix typo in appveyor.yml 2022-07-04 19:24:58 +02:00
BUILD-CMAKE
CMakeLists.txt Merge branch '10.4' into 10.5 2023-09-05 12:41:49 +07:00
config.h.cmake Merge branch '10.4' into 10.5 2024-01-31 17:32:53 +01:00
configure.cmake MDEV-25252 main.type_float fails in new buildbot 2024-03-27 16:14:55 +01:00
CONTRIBUTING.md Remove mention of Freenode 2021-09-22 07:15:08 +02:00
COPYING Update FSF Address 2019-05-11 21:29:06 +03:00
CREDITS CREDITS: re-instate Tencent Cloud 2023-01-25 16:44:26 +11:00
INSTALL-SOURCE
INSTALL-WIN-SOURCE
KNOWN_BUGS.txt Changed some MySQL names in messages to MariaDB 2018-12-09 20:49:05 +02:00
README.md Remove mention of Freenode 2021-09-22 07:15:08 +02:00
THIRDPARTY Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
VERSION bump the VERSION 2024-02-08 09:05:18 +01:00

Code status:

  • Appveyor CI status ci.appveyor.com

MariaDB: The open source relational database

MariaDB was designed as a drop-in replacement of MySQL(R) with more features, new storage engines, fewer bugs, and better performance.

MariaDB is brought to you by the MariaDB Foundation and the MariaDB Corporation. Please read the CREDITS file for details about the MariaDB Foundation, and who is developing MariaDB.

MariaDB is developed by many of the original developers of MySQL who now work for the MariaDB Corporation, the MariaDB Foundation and by many people in the community.

MySQL, which is the base of MariaDB, is a product and trademark of Oracle Corporation, Inc. For a list of developers and other contributors, see the Credits appendix. You can also run 'SHOW authors' to get a list of active contributors.

A description of the MariaDB project and a manual can be found at:

https://mariadb.org

https://mariadb.com/kb/en/

https://mariadb.com/kb/en/mariadb-vs-mysql-features/

https://mariadb.com/kb/en/mariadb-versus-mysql-compatibility/

https://mariadb.com/kb/en/new-and-old-releases/

Help

More help is available from the Maria Discuss mailing list https://launchpad.net/~maria-discuss, MariaDB's Zulip instance, https://mariadb.zulipchat.com/

Live QA for beginner contributors

MariaDB has a dedicated time each week when we answer new contributor questions live on Zulip. From 8:00 to 10:00 UTC on Mondays, and 10:00 to 12:00 UTC on Thursdays, anyone can ask any questions theyd like, and a live developer will be available to assist.

New contributors can ask questions any time, but we will provide immediate feedback during that interval.

Licensing


NOTE:

MariaDB is specifically available only under version 2 of the GNU General Public License (GPLv2). (I.e. Without the "any later version" clause.) This is inherited from MySQL. Please see the README file in the MySQL distribution for more information.

License information can be found in the COPYING file. Third party license information can be found in the THIRDPARTY file.


Bug Reports

Bug and/or error reports regarding MariaDB should be submitted at: https://jira.mariadb.org

For reporting security vulnerabilities see: https://mariadb.org/about/security-policy/

The code for MariaDB, including all revision history, can be found at: https://github.com/MariaDB/server