[systemd-devel] Fwd: race conditions after SIGTERM
Reindl Harald
h.reindl at thelounge.net
Thu Jul 24 04:24:38 PDT 2014
maybe that's a systemd thing
i know Fedora 19 has not a recent systemd but the question
remains if systemctl in case of "Type=simple" may act the same
way while stop a service as for starting - send the SIGTERM
and immediately return while the binary still writes data
that could explain race conditions like below
* stop mysqld instance 1
* stop mysqld instance 2
* the services still flush data but "systemctl" already returned
* rsync both datadir
* corruption
-------- Original-Nachricht --------
Betreff: race conditions after SIGTERM
Datum: Thu, 24 Jul 2014 12:42:51 +0200
Von: Reindl Harald <h.reindl at thelounge.net>
An: Mailing-List mariadb <"maria-discuss"@lists.launchpad.net>
how can that script lead to a race condition where files
are not fully written to disk? that never happens if the
systemd-unit for the replication instance has
"ExecStopPost=/usr/bin/sleep 1" and waits a while
my only explaination is that mysqld returns after the SIGTERM
from systemd before all data are completly written in some racy
situations and so rsynced incompletly to the datadir of the
other instance
_________________________________________________________
#!/bin/bash
systemctl stop replication.service
systemctl stop mysqld.service
rsync $RSYNC_PARAMS /mysql_replication/ /mysql_data/
systemctl start replication.service
systemctl start mysqld.service
_________________________________________________________
[Unit]
Description=MariaDB Replication
[Service]
Type=simple
PIDFile=/run/mysqld/mysqld_replication.pid
ExecStart=/usr/libexec/mysqld --defaults-file=/etc/my-replication.cnf --pid-file=/run/mysqld/mysqld_replication.pid
--socket=/var/lib/mysql/mysql_replication.sock --open-files-limit=30000 --basedir=/usr --user=mysql
Environment="LANG=en_GB.UTF-8"
Restart=always
RestartSec=1
_________________________________________________________
140724 12:22:59 [Note] /usr/libexec/mysqld: Shutdown complete
140724 12:23:01 [Note] Plugin 'InnoDB' is disabled.
Cannot find checkpoint record at LSN (1,0x35767)
140724 12:23:01 [ERROR] mysqld: Aria recovery failed. Please run aria_chk -r on all Aria tables and delete all
aria_log.######## files
140724 12:23:01 [ERROR] Plugin 'Aria' init function returned error.
140724 12:23:01 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
140724 12:23:01 [Note] Plugin 'FEDERATED' is disabled.
140724 12:23:01 [Note] Plugin 'FEEDBACK' is disabled.
140724 12:23:01 [ERROR] Aria engine is not enabled or did not start. The Aria engine must be enabled to continue as
mysqld was configured with --with-aria-tmp-tables
140724 12:23:01 [ERROR] Aborting
140724 12:23:01 [Note] /usr/libexec/mysqld: Shutdown complete
140724 12:23:03 [Note] Plugin 'InnoDB' is disabled.
Cannot find checkpoint record at LSN (1,0x35767)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 246 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20140724/7b8c91b2/attachment.sig>
More information about the systemd-devel
mailing list