Opened 15 years ago

Closed 15 years ago

#20365 closed defect (worksforme)

MySQL plist file creating unmanaged launchd jobs on boot

Reported by: conradwt (Conrad Taylor) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 1.7.1
Keywords: Cc:
Port: mysql5

Description (last modified by ryandesign (Ryan Carsten Schmidt))

I'm using Mac OS 10.5.7 and launchd plist script for MySQL Server 5.0.81 appears to be creating unmanaged jobs. For example, the

sudo launchctl list | grep mysql
137     -       0x10b050.mysqld
137     -       0x10a2a0.mysqld

Note: The above are anonymous jobs on Mac OS 10.5.7 that cannot be unloaded.

However, there's no way to manage these jobs because there's no associated plist file to unload them. At this time, the process is running:

ps ax | grep mysql
98   ??  S      0:00.02 /bin/sh ./bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/darnoc-desktop.local.pid
137   ??  S      0:01.06 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql --pid-file=/usr/local/mysql/data/darnoc-desktop.local.pid

Thus, Damien Sorresso recommends the following:

add a "-launchd" flag to the startup options

Change History (7)

comment:1 Changed 15 years ago by blb@…

Owner: changed from macports-tickets@… to ryandesign@…

MacPorts' mysql5-server port should install org.macports.mysql5 (/Library/LaunchDaemons/org.macports.mysql5.plist) as the launchd item for mysql5. Also, it won't be in /usr/local/mysql so it sounds as if you have a non-MacPorts install of mysql which may be getting in the way.

comment:2 Changed 15 years ago by conradwt (Conrad Taylor)

After correcting the previous issue, here's what I'm seeing when I perform a 'ps ax | grep mysql':

PowerMac G5 - Leopard Build (9J61)

1204 ?? Ss 0:00.01 /opt/local/bin/daemondo --label=mysql5 --start-cmd /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper start ; --stop-cmd /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper stop ; --restart-cmd /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper restart ; --pid=none

1213 ?? S 0:00.02 /bin/sh /opt/local/lib/mysql5/bin/mysqld_safe --datadir=/opt/local/var/db/mysql5 --pid-file=/opt/local/var/db/mysql5/darnoc-desktop.local.pid

1233 ?? S 0:00.20 /opt/local/libexec/mysqld --basedir=/opt/local --datadir=/opt/local/var/db/mysql5 --user=mysql --pid-file=/opt/local/var/db/mysql5/darnoc-desktop.local.pid

Note: pid 1233 corresponds to the anonymous jobs: 0x10d310.mysqld and 0x10ce60.mysqld

MacBook Pro - Snow Leopard Build (10A411)

797 ?? Ss 0:00.01 /opt/local/bin/daemondo --label=mysql5 --start-cmd /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper start ; --stop-cmd /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper stop ; --restart-cmd /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper restart ; --pid=none

807 ?? S 0:00.01 /bin/sh /opt/local/lib/mysql5/bin/mysqld_safe --datadir=/opt/local/var/db/mysql5 --pid-file=/opt/local/var/db/mysql5/darnoc-laptop.local.pid

827 ?? S 0:00.24 /opt/local/libexec/mysqld --basedir=/opt/local --datadir=/opt/local/var/db/mysql5 --user=mysql --pid-file=/opt/local/var/db/mysql5/darnoc-laptop.local.pid

Note: pid 827 corresponds to an anonymous job: 0x100101610.anonymous.mysqld.

Are these anonymous jobs or extra processes needed by MySQL to function as a database server?

comment:3 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

I have never used "sudo launchctl list" before so I am unfamiliar with its output. But on my Leopard system I get:

$ ps ax | grep mysql
  529   ??  Ss     0:00.02 /mp/bin/daemondo --label=mysql5 --start-cmd /mp/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper start ; --stop-cmd /mp/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper stop ; --restart-cmd /mp/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper restart ; --pid=none
  538   ??  S      0:00.02 /bin/sh /mp/lib/mysql5/bin/mysqld_safe --datadir=/mp/var/db/mysql5 --pid-file=/mp/var/db/mysql5/leopard.local.pid
  559   ??  S      0:00.15 /mp/libexec/mysqld --basedir=/mp --datadir=/mp/var/db/mysql5 --user=mysql --pid-file=/mp/var/db/mysql5/leopard.local.pid
  565 s000  S+     0:00.00 grep mysql
$ sudo launchctl list | grep mysql
559     -       0x10c4e0.mysqld
559     -       0x10c0b0.mysqld
529     -       org.macports.mysql5
$

The ps output at least seems normal to me for MacPorts. MacPorts uses daemondo to wrap all startup processes. daemondo starts mysqld_safe, and mysqld_safe starts mysqld. You start and stop MacPorts mysql5 using "sudo port load mysql5-server" and "sudo port unload mysql5-server". Does this work for you?

comment:4 Changed 15 years ago by conradwt (Conrad Taylor)

Would it possible to simply have launchd manage this instead of using both launchd and daemondo? Also, it seems that there might be a good reason to have the following:

/Library/LaunchDaemons/org.macports.mysql5.plist /Library/LaunchDaemons/org.macports.mysql5-server.plist

From what I understand about launchd and after watching the WWDC09 video on the subject, it would be possible to deal with this type of dependency scenario. I will need to do some research in this regard.

comment:5 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

mysql5 is meant to be the client only. Thus it needn't have any launchd plist; there's nothing for it to start. mysql5-server is the server component and is there to start safe_mysqld.

MacPorts always uses daemondo for startup items. If you want to discuss changing this, you should bring it up on the macports-dev mailing list.

comment:6 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

comment:7 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.