Bug 122063 - databases/mysql51-server - Mysql-server rc.d script finishes before mysqld has established listening socket.
databases/mysql51-server - Mysql-server rc.d script finishes before mysqld ha...
Status: Closed FIXED
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s)
Latest
Any Any
: Normal Affects Only Me
Assigned To: Alex Dupre
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-03-25 04:40 UTC by chris
Modified: 2008-06-07 09:40 UTC (History)
0 users

See Also:


Attachments
file.diff (1.50 KB, patch)
2008-03-25 04:40 UTC, chris
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description chris 2008-03-25 04:40:03 UTC
The rc.d script shipped with the port of mysql server exits immediately after mysqld starts. This normally wouldn't be a problem but the mysql daemon exits about a second before it has established it's unix domain listening socket: "/tmp/mysql". The problem here is that the rc startup system can queue the next daemon to start before "/tmp/mysql" is available. If the next daemon needs mysql it will fail and exit. On my system rcorder starts mysql-server and then immediately follows up with jabberd. Since mysql doesn't appear ready for about a  second jabberd fails and exits. 

I've attached a patch which waits for up to 15 seconds for the /tmp/mysql socket to appear in the filesystem and exits as soon as it's available. This allows the next daemon in line to startup properly if it needs mysql. Note that I have had this problem with postfix up until I removed my mail information from mysql.

Fix: This may not adhere to the strictest rules of the rcorder system but my solution is to hack the provider's (mysql-server) startup script. The goal was to prevent the script from exiting until either the listening socket is established or a 15 second timeout has passed.

A better solution would be for mysqld to establish the listening socket first (even if it ignores incoming connections for a little bit) but that's much higher effort.

Patch attached with submission follows:
How-To-Repeat: Build a system that uses mysql and jabber or postfix. Ensure that jabberd starts after mysql by hacking /usr/local/etc/rc.d/jabberd's ## REQUIRES line. Assuming you're not on some hot rod of a machine check your logs for jabberd2's failure line in the service manager.
Comment 1 Edwin Groothuis freebsd_committer 2008-03-25 05:17:36 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ale

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 dfilter freebsd_committer 2008-06-07 09:33:55 UTC
ale         2008-06-07 08:33:50 UTC

  FreeBSD ports repository

  Modified files:
    databases/mysql51-server Makefile distinfo 
    databases/mysql51-server/files mysql-server.sh.in 
  Log:
  Update to 5.1.25-rc release.
  Fix startup script to wait until server is completely up. [1]
  
  PR:             ports/122063 [1]
  Submitted by:   Christopher Sean Hilton <chris@vindaloo.com> [1]
  
  Revision  Changes    Path
  1.232     +2 -2      ports/databases/mysql51-server/Makefile
  1.103     +3 -3      ports/databases/mysql51-server/distinfo
  1.5       +12 -1     ports/databases/mysql51-server/files/mysql-server.sh.in
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 3 Alex Dupre freebsd_committer 2008-06-07 09:34:11 UTC
State Changed
From-To: open->closed

A slightly different patch has been applied, thanks.