Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 175783
Alias:
Product:
Component:
Status: ASSIGNED
Resolution:
Assigned To: Gentoo Linux MySQL bugs team <mysql-bugs@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Bjarke Istrup Pedersen <gurligebis@gentoo.org>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
mysql mysql init script text/plain Roy Marples (RETIRED) 2007-05-24 15:55 0000 1.71 KB Details
ewaitfile.diff Add ewaitfile to openrc patch Roy Marples 2008-06-02 15:49 0000 2.60 KB Details | Diff
mysql-initd.diff Use ewaitfile patch Davide Pesavento 2009-05-17 13:40 0000 994 bytes Details | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 175783 depends on: Show dependency tree
Bug 175783 blocks: 173057
Votes: 10    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.







View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2007-04-24 00:51 0000
When using baselayout-2 on Gentoo/FreeBSD, mysql fails to start with the 
following error:

# /etc/init.d/mysql start
 * Caching service dependencies ...
/etc/init.d/mysql: 9: Syntax error: "(" unexpected
/etc/init.d/mysqlmanager: 14: Syntax error: "(" unexpected                      
                                       [ ok ]
/etc/init.d/mysql: 9: Syntax error: "(" unexpected
 * ERROR: mysql failed to start

------- Comment #1 From Roy Marples (RETIRED) 2007-05-24 15:55:29 0000 -------
Created an attachment (id=120196) [details]
mysql init script

Then then. The current scripts try to re-invent too many wheels. baselayout has
supported the concept of multiplexing for some time. link the scripts to mysql
to do this like so
ln -s mysql /etc/init.d/mysql.foo
Then MY_CNF will default to /etc/mysql.foo/my.cnf.

This new script is very simple and should work just fine. Any special args
should be placed in /etc/conf.d/mysql like so

MY_CNF="/etc/myfoo/my.cnf" (defaults to /etc/mysql/my.cnf)
MY_ARGS="--optionone=1--optiontwo=2"

------- Comment #2 From Roy Marples (RETIRED) 2007-05-24 16:01:35 0000 -------
Oh yes - what's the mysqlmanager script for? I've not touched that as it seems
pointless?

------- Comment #3 From Roy Marples (RETIRED) 2007-08-08 02:22:59 0000 -------
*** Bug 166606 has been marked as a duplicate of this bug. ***

------- Comment #4 From Roy Marples (RETIRED) 2007-08-08 02:24:17 0000 -------
I for one won't let this hold up baselayout-2

------- Comment #5 From Davide Pesavento 2007-09-27 21:45:39 0000 -------
Is someone going to fix this one?

------- Comment #6 From Jonathan Dehan 2008-02-19 21:05:18 0000 -------
Please commit the script!

------- Comment #7 From Jakub Moc (RETIRED) 2008-03-20 16:38:38 0000 -------
Well seriously WTH is up with this?

------- Comment #8 From Robin Johnson 2008-03-22 03:30:59 0000 -------
roy: you wrote this, and there's one critical problem with it.

MySQL should NOT be considered up until the socket comes into existence at
/var/run/mysqld/mysqld.sock.

Depending on the size of your databases, this can be anywhere from 0 to ~60
seconds after the process has been backgrounded by s-s-d. If the init script
returns success right away, and the next thing that tries to start wants to use
the socket, then it's going to fail.

In the previous edition of the scripts, we looped checking for that socket -
should that logic come back, or can you suggest a better way?

------- Comment #9 From Roy Marples 2008-03-22 08:06:05 0000 -------
Fix mysql to create the socket before daemonising?
But aside from the proper fix, no I don't have any other ideas at this time. If
other daemons have the same flaw, then maybe a function could be created

ewaitfile /var/run/mysqld/mysqld.sock 60

Give it 60 seconds to create the socket.

------- Comment #10 From Robin Johnson 2008-03-22 21:05:31 0000 -------
roy: mysql doesn't daemonize. ssd does the work itself via --background.

I'd be up for an ewaitfile being provided by baselayout, I certainly do see
other cases where it would be a good solution.

------- Comment #11 From Roy Marples 2008-03-23 22:27:29 0000 -------
OK, maybe adding it to ssd would be the better solution then. However, that
won't easily fly for baselayout-1.

------- Comment #12 From Robin Johnson 2008-03-23 22:33:43 0000 -------
How about a fallback in the mysql script, that if a ewaitfile function is not
already available, it defines one of it's own?

------- Comment #13 From Roy Marples 2008-03-23 23:00:10 0000 -------
No, I was thinking about adding it to ssd

start-stop-daemon --waitfile /foo

------- Comment #14 From Robin Johnson 2008-03-23 23:15:20 0000 -------
here's a trick that should work, but it's a bit unclean.
BTW, is there something better than existence of librc that init.d scripts can
check to see if they are running under baselayout2?

=====
[ -e /lib/librc.so ] && opts="${opts} --waitfile foo"
start-stop-daemon ${opts} ...
[ -e /lib/librc.so ] || ewaitfile /foo
=====

------- Comment #15 From Roy Marples 2008-03-23 23:20:11 0000 -------
Not really no...
I suppose we could export a function
openrcpreq so you could do this

if openrcpreq 1 2; then
  funk new feature
elif openrcpreq 1 0; then
  inital release feature
else
  sol :P
fi

------- Comment #16 From SpanKY 2008-03-25 17:05:42 0000 -------
that's pretty ugly as well

we can just add things to baselayout-1.x to ease transition as needed ... ive
already been doing this for some time

------- Comment #17 From Roy Marples 2008-06-02 15:49:08 0000 -------
Created an attachment (id=155247) [details]
Add ewaitfile to openrc

This adds the ewaitfile function to OpenRC.
ewaitfile timeout file1 [file2 ...]
If timeout <1, then we wait forever.

Comments?

------- Comment #18 From Robin Johnson 2008-06-02 18:44:49 0000 -------
uberlord: looks good, and just in time for final upcoming pass at putting this
in the tree. Tell me what version of openrc it goes into, so I can have a
suitable RDEPEND entry.

------- Comment #19 From Roy Marples 2008-06-03 12:00:31 0000 -------
It will go into openrc-0.2.6 which will be cut once bug #224171 is solved - if
I can work out wtf is going wrong there :)

In the mean time, feel free to patch 0.2.5 with it if you like as it could be
out today or a week or so.

------- Comment #20 From Doug Goldstein 2008-10-07 15:49:10 0000 -------
ewaitfile now exists in 0.3.0.

------- Comment #21 From Robin Johnson 2008-11-14 21:51:36 0000 -------
*** Bug 173057 has been marked as a duplicate of this bug. ***

------- Comment #22 From Jeremy Murphy 2009-01-02 12:09:37 0000 -------
Mysql has always started up fine for me until just recently, I presume with the
upgrade to openrc 0.4.x (since I run ~amd64).  Does that make sense, or is it
meant to be working now?

------- Comment #23 From Davide Pesavento 2009-03-23 15:59:03 0000 -------
Ping! What's holding this back?

------- Comment #24 From James Le Cuirot 2009-04-25 20:39:05 0000 -------
It looks as though a different fix to the one that was suggested was applied at
some point since this is already in the init script. Not sure when this
happened.

while ! [[ -S "${socket}" || "${STARTUPTIMEOUT}" -lt 1 || "${retstatus}" -ne 0
]] ; do
  STARTUPTIMEOUT=$(( STARTUPTIMEOUT - 1 ))
  [[ ${DEBUG} -ge 1 ]] && echo -n "${STARTUPTIMEOUT},"
  sleep ${TIMEUNIT}
done

Something's still not right though. I set the timeout to 15 seconds, which was
long enough for MySQL to start without the script reporting a failure but
mythbackend seems to give up waiting before its ready. I always have to run
"rc" after my system has booted to give it another shot at starting. Maybe this
isn't the exact cause but I'm pretty sure MySQL is to blame.

------- Comment #25 From Davide Pesavento 2009-05-17 13:40:47 0000 -------
Created an attachment (id=191550) [details]
Use ewaitfile

I've been running Roy's script with the addition of ewaitfile (see attached
patch) for quite some time now. No problems so far. I don't have large
databases though, so testing from people with some large DBs is appreciated.

The timeout parameter for ewaitfile can be made configurable via conf.d if
needed, for now it's hardcoded at 60 seconds.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug