[Mailman-Users] Mailman vs OSX vs launchd

Larry Stone lstone19 at stonejongleux.com
Fri Jun 26 18:06:40 CEST 2009


On Fri, 26 Jun 2009, Sebastian Hagedorn wrote:

>>> On 6/18/09 7:11 PM, Bryan Harrison at bryan at bryanharrison.com wrote:
>>> 
>>>> If I allow launchd to start it
>>>> S<caron>I get an endless succession ofS<caron>
>>>> 
>>>> Jun 18 16:50:26 org.list.mailmanctl[1697]: Starting Mailman's master
>>>> qrunner.
>>>> Jun 18 16:50:26 com.apple.launchd[1] (org.list.mailmanctl[1697]):
>>>> Stray process with PGID equal to this dead job: PID 1698 PPID 1 Python
>>>> Jun 18 16:50:26 com.apple.launchd[1] (org.list.mailmanctl): Throttling
>>>> respawn: Will start in 9 seconds

I just caught that Bryan notes that he receives an "endless succession" of 
those messages where as I see one and that's it.

Comparing our launchd .plist files, I see a few differences:
Bryan:
 	<key>OnDemand</key>
 	<false/>
Me:
 	<key>OnDemand</key>
 	<true/>
 	<key>RunAtLoad</key>
 	<true/>

Bryan does not have RunAtLoad but the default is false. I think this is 
why he sees the "endless succession" and I don't. Wiht RunAtLoad but 
OnDemand set true, my system tries once at startup and that's it. Bryan, 
due to OnDemand being false (meaning keep it running continuously), keeps 
trying.

Another difference (but I think making no difference is:
Bryan:
         <key>Program</key>
         <string>/usr/share/mailman/bin/mailmanctl</string>
         <key>ProgramArguments</key>
         <array>
                 <string>mailmanctl</string>
                 <string>-s</string>
                 <string>start</string>
         </array>

Me:
         <key>ProgramArguments</key>
         <array>
                 <string>/Applications/Mailman/bin/mailmanctl</string>
                 <string>-s</string>
                 <string>start</string>
         </array>

I don't have a Program key. I don't think this is relevant as I specify 
the full path in ProgramArguments which Bryan does not need to do since he 
specified the path in Program.

> The reason this happens is that launchd expects the processes it 
> launches to stick around. They must not daemonize. But mailmanctl 
> terminates after it has started the runners. I assume that Apple 
> modified their own distribution of Mailman so that mailmanctl behaves 
> differently. I'd suggest comparing the two.

I'm not so sure. It worked fine for me under Tiger (client). Drew reports 
the same thing with OS X Server - worked fine under Tiger (10.4.x) and 
then the same problems as the rest of us with Leopard.

Also, I can't say I agree that launchd expects the program to stick 
around. With it the way I have it set (RunAtLoad true and OnDemand true), 
it makes one attempt at startup and does not care after that whether it 
started or not. I'll note that I also have Clam-AV's daemon (clamd) 
starting the same way and it seems to work OK but some of the technical 
issues of launching daemon with launchd are beyond me. However, the 
launchd.plist(5) man page says:

EXPECTATIONS
Daemons or agents managed by launchd are expected to behave certain ways.

A daemon or agent launched by launchd MUST NOT do the following in the 
process directly launched by launchd:

            o   fork(2) and have the parent process exit(3) or _exit(2).
            o   Call daemon(3)

A daemon or agent launched by launchd SHOULD NOT do the following as a 
part of their startup initialization:

 	Setup the user ID or group ID.
            o   Setup the working directory.
            o   chroot(2)
            o   setsid(2)
            o   Close "stray" file descriptors.
            o   Change stdio(3) to /dev/null.
            o   Setup resource limits with setrusage(2).
            o   Setup priority with setpriority(2).
            o   Ignore the SIGTERM signal.

A daemon or agent launched by launchd SHOULD:

            o   Launch on demand given criteria specified in the XML property
                list.  More information can be found in launch(3).
            o   Catch the SIGTERM signal.

I'll leave it to those better into the technical end of things to 
interpret that relative to what mailmanctl does.

-- Larry Stone
    lstone19 at stonejongleux.com


More information about the Mailman-Users mailing list