Bug 714486 - systemd fires services too fast
Summary: systemd fires services too fast
Keywords:
Status: CLOSED CANTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 15
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Lennart Poettering
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-06-19 15:31 UTC by Harald Reindl
Modified: 2011-06-20 11:46 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-06-20 11:46:55 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Harald Reindl 2011-06-19 15:31:12 UTC
how can it be that i get these errors while bootlog shows that mysql  is 
started BEFORE? this is a major bug becasue ususally services depending 
one from anohter at it has a reason that their start is orderd and
i have never seen this behavior with a ordered sysvinit/upstart boot

Jun 19 17:20:52 srv-rhsoft dbmail/lmtpd[1305]: Error:[sql] dbmysql.c,db_connect(+172): mysql_real_connect failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Jun 19 17:20:52 srv-rhsoft dbmail/imap4d[1304]: Error:[sql] dbmysql.c,db_connect(+172): mysql_real_connect failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Jun 19 17:20:52 srv-rhsoft dbmail/timsieved[1309]: Error:[sql] dbmysql.c,db_connect(+172): mysql_real_connect failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Jun 19 17:20:52 srv-rhsoft dbmail/lmtpd[1305]: FATAL:[server] server.c,StartServer(+129): Unable to connect to database.
Jun 19 17:20:52 srv-rhsoft dbmail/imap4d[1304]: FATAL:[server] server.c,StartServer(+129): Unable to connect to database.
Jun 19 17:20:52 srv-rhsoft dbmail/timsieved[1309]: FATAL:[server] server.c,StartServer(+129): Unable to connect to database.
Jun 19 17:20:52 srv-rhsoft dovecot: master: Dovecot v2.0.13 starting up (core dumps disabled)
Jun 19 17:20:58 srv-rhsoft postfix/postfix-script[1525]: starting the Postfix mail system
Jun 19 17:20:59 srv-rhsoft postfix/master[1548]: daemon started -- version 2.8.3, configuration /etc/postfix

Started MySQL Database.
Starting Pulseaudio Daemon...
Starting SAMBA Fileserver...
Starting HTTP Server (prefork MPM)...
Starting DBMail LMTP Server...
Started DBMail LMTP Server.
Starting Network Time Service...
Started Network Time Service.
Starting LSB: The CUPS scheduler...
Starting LSB: start|stop|status|restart|try-restart|reload|force-reload DNS server...
Starting Avahi mDNS/DNS-SD Stack...
Starting LSB: Manages the services needed to run VMware software...
Starting lm_sensors for monitoring motherboard sensor values...
cups starten: Starting Self Monitoring and Reporting Technology (SMART) Daemon...
Started Self Monitoring and Reporting Technology (SMART) Daemon.
Starting irqbalance daemon...
Starting Command Scheduler...
Started Command Scheduler.
Starting DHCPv4 Server Daemon...
Started DHCPv4 Server Daemon.
Starting D-Bus System Message Bus...
Starting DBMail IMAP Server...
Started DBMail IMAP Server.
Starting MySQL Replication...
Started MySQL Replication.
Starting Dovecot IMAP/POP3 Proxy...
Started Dovecot IMAP/POP3 Proxy.
Starting DBMail Policy Service...
Starting pure-ftpd...
Starting DBMail SIEVE Server...
Started DBMail SIEVE Server.
Started DBMail Policy Service.
Starting Postfix MTA...

[root@srv-rhsoft:~]$ cat /lib/systemd/system/dbmail-lmtpd.service 
[Unit]
Description=DBMail LMTP Server
After=syslog.target local-fs.target network.target mysqld.service
Before=postfix.service
[Service]
Type=simple
ExecStart=/usr/sbin/dbmail-lmtpd -D
Restart=always
RestartSec=2
[Install] 
WantedBy=multi-user.target

[root@srv-rhsoft:~]$ cat /lib/systemd/system/mysqld.service 
[Unit]
Description=MySQL Database
After=network.target
Before=syslog.target httpd.service postfix.service dovecot.service dbmail-imapd.service dbmail-lmtpd.service dbmail-pop3d.service dbmail-postfix-policyd.service
[Service]
Type=simple
PIDFile=/var/run/mysqld/mysqld.pid
ExecStart=/usr/libexec/mysqld --defaults-file=/etc/my.cnf --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock --user=mysql
ExecStop=/bin/kill -15 $MAINPID
Restart=always
RestartSec=2
TimeoutSec=60
ExecStartPost=/bin/sleep 2
[Install]
WantedBy=multi-user.target

# WE DO NOT KNOW HOW TO INCLUDE SOMETHING LIKE THIS TO MAKE "largepages" WORKING
# [root@srv-rhsoft:~]$ cat /etc/my.memory.cnf
# echo 200 > /proc/sys/vm/nr_hugepages
# echo 27 > /proc/sys/vm/hugetlb_shm_group
# echo 2097152 > /proc/sys/kernel/shmall
# ulimit -l unlimited
# ulimit -n 30000
# InnoDB: HugeTLB: Warning: Failed to allocate 109051904 bytes. errno 1
# InnoDB HugeTLB: Warning: Using conventional memory pool
#
# WE HOPE THAT "ExecStartPost=/bin/sleep 2" RESULTS IN A DELAY BEFORE STARTING SEVICES DEPENDING ON
# MYSQL BECAUSE A SUCCESSFULL START DOES NOT MEAN THAT MYSQL IS READY FOR CONNECTIONS AND SOME 
# MAILSERVICES IN MYSQL-DRIVEN ENVIRONEMNTS ARE FAILING IF STARTED TOO SOON

Comment 1 Elad Alfassa 2011-06-19 15:48:00 UTC
I'm not a systemd developer and never written a service file, but I think you might want to use socket activation here.



-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers

Comment 2 Harald Reindl 2011-06-19 15:59:55 UTC
we are speaking here not only about unix-sockets

it is also useles fire up a imap-proxy before the tcp-service on 127.0.0.1 is ready, there are a lot of other examples where it is strongly recommended that the start-order is clean

the fault of syetmd for me is try to boot as fast as it can and all resulting troubles are seen as collateral damages - nobody is intesrest if his server starts 5 seconds faster if it is not relieable after that

and i am and enduser which tries to make his F15 setup complete what it is 
not as shipped - so i like to see systemd trsutable work as sysvinit did over 40 years

Comment 3 Elad Alfassa 2011-06-19 16:07:20 UTC
Also why do you want mysqld to start *before* syslog?



-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers

Comment 4 Elad Alfassa 2011-06-19 16:09:15 UTC
and see here: http://0pointer.de/public/systemd-man/systemd.service.html 

If [type] set to simple (the default value) it is expected that the process configured with ExecStart= is the main process of the service. In this mode, if the process offers functionality to other processes on the system its communication channels should be installed before the daemon is started up (e.g. sockets set up by systemd, via socket activation), as systemd will immediately proceed starting follow-up units.



-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers

Comment 5 Harald Reindl 2011-06-19 16:26:09 UTC
so the After and Before is quite useless 
what should they do if it does not matter what you configure?


i want mysqld before rsyslog because rsyslog-mysql is used
believe me that i really know exactly why what order of every 
little piece of service is needed as it is on all machines
i maintain

Comment 6 Michal Schmidt 2011-06-20 11:46:55 UTC
"Type=simple" is suitable for servers only if they provide socket activation, because with this type is not possible to detect if the service is still starting or if it has fully started already.

(In reply to comment #2)
> and i am and enduser which tries to make his F15 setup complete what it is 
> not as shipped

By making F15 complete you mean replacing _all_ SysV initscripts by systemd unit files? Then you are not just an end user, but also a developer. I recommend you to join the upstream systemd-devel mailing list and the #systemd IRC channel and discuss any questions you have about systemd there. Helping with conversions to native unit files is surely a welcome effort, but you need to know what you're doing and it's best to work with upstream.

I am closing this bug as CANTFIX, because the described problems are not bugs in F15. They are caused by buggy custom unit files.


Note You need to log in before you can comment on or make changes to this bug.