[launchd-dev] Launch Agent and per-user launchd not exiting on logout (10.5.8)

Sidney San Martín s at sidneysm.com
Fri Aug 20 13:03:10 PDT 2010


I ran into a machine running OS 10.5.8 recently where our launchd
agent and the user's launchd did not terminate at logout.

On the next login, an "Already loaded" message was logged for our
plist, followed by a number of errors from the agent itself. A snippet
of the log is below.

After killing and relaunching the agent it was fine for that session.
After rebooting the machine, I was unable to reproduce the problem.

I remember happening in 10.4, but never in 10.5... Are there any
circumstances that'd cause launchd to misbehave like this? Is there
anything I should be doing to handle the situation more gracefully in
my agent?

    6/18/10 4:15:41 PM com.apple.launchctl.Aqua[957]
com.mycompany.agent: Already loaded
    6/18/10 3:54:47 PM MyCompany Agent[616] _NXPlaceWindow: error
setting window shape (268435459)
    6/18/10 3:54:47 PM MyCompany Agent[616] _NSShapePlainWindow: error
setting window shape (268435459)
    6/18/10 3:54:47 PM MyCompany Agent[616] _NSShapePlainWindow: error
setting window shape (268435459)
    6/18/10 3:54:47 PM MyCompany Agent[616] CGSLookupServerPort:
_CGSSessionDeathWatchPort(gSessionPort) returns 268435459
    6/18/10 3:54:47 PM com.mycompany.agent[616] Fri Jun 18 15:54:47
Terminal-1.local MyCompany Agent[616] <Warning>: CGSLookupServerPort:
_CGSSessionDeathWatchPort(gSessionPort) returns 268435459
    6/18/10 3:54:47 PM MyCompany Agent[616]
CGSShutdownServerConnections: Detaching application from window server
    6/18/10 3:54:47 PM com.mycompany.agent[616] Fri Jun 18 15:54:47
Terminal-1.local MyCompany Agent[616] <Warning>:
CGSShutdownServerConnections: Detaching application from window server
    6/18/10 3:54:47 PM MyCompany Agent[616] CGSDisplayServerShutdown:
Detaching display subsystem from window server
    6/18/10 3:54:47 PM com.mycompany.agent[616] Fri Jun 18 15:54:47
Terminal-1.local MyCompany Agent[616] <Warning>:
CGSDisplayServerShutdown: Detaching display subsystem from window
server
    6/18/10 3:54:59 PM MyCompany Agent[616] kCGErrorCannotComplete :
CGSDeviceGetGeometry: Invalid device window
    6/18/10 3:54:59 PM MyCompany Agent[616] kCGErrorCannotComplete :
CGSDeviceGetGeometry: Invalid device window
    6/18/10 3:54:59 PM MyCompany Agent[616] kCGErrorInvalidConnection
: CGSGetWindowGeometry: Invalid connection
    6/18/10 3:54:59 PM MyCompany Agent[616] kCGErrorInvalidConnection
: CGSGetWindowGeometry: Invalid connection
    6/18/10 3:54:59 PM MyCompany Agent[616] kCGErrorInvalidConnection
: CGSGetWindowGeometry: Invalid connection
    6/18/10 3:54:59 PM MyCompany Agent[616] kCGErrorInvalidConnection
: CGSGetWindowGeometry: Invalid connection
    6/18/10 3:54:59 PM MyCompany Agent[616] kCGErrorCannotComplete :
CGSDeviceGetGeometry: Invalid device window
    6/18/10 3:54:59 PM com.mycompany.agent[616] Fri Jun 18 15:54:59
Terminal-1.local MyCompany Agent[616] <Error>: kCGErrorCannotComplete
: CGSDeviceGetGeometry: Invalid device window
    6/18/10 3:54:59 PM com.mycompany.agent[616] Fri Jun 18 15:54:59
Terminal-1.local MyCompany Agent[616] <Error>: kCGErrorCannotComplete
: CGSDeviceGetGeometry: Invalid device window
    6/18/10 3:54:59 PM com.mycompany.agent[616] Fri Jun 18 15:54:59
Terminal-1.local MyCompany Agent[616] <Error>:
kCGErrorInvalidConnection : CGSGetWindowGeometry: Invalid connection
    6/18/10 3:54:59 PM com.mycompany.agent[616] Fri Jun 18 15:54:59
Terminal-1.local MyCompany Agent[616] <Error>:
kCGErrorInvalidConnection : CGSGetWindowGeometry: Invalid connection
    6/18/10 3:54:59 PM com.mycompany.agent[616] Fri Jun 18 15:54:59
Terminal-1.local MyCompany Agent[616] <Error>:
kCGErrorInvalidConnection : CGSGetWindowGeometry: Invalid connection
    6/18/10 3:54:59 PM com.mycompany.agent[616] Fri Jun 18 15:54:59
Terminal-1.local MyCompany Agent[616] <Error>:
kCGErrorInvalidConnection : CGSGetWindowGeometry: Invalid connection
    6/18/10 3:54:59 PM com.mycompany.agent[616] Fri Jun 18 15:54:59
Terminal-1.local MyCompany Agent[616] <Error>: kCGErrorCannotComplete
: CGSDeviceGetGeometry: Invalid device window
    6/18/10 3:54:59 PM com.mycompany.agent[616] Fri Jun 18 15:54:59
Terminal-1.local MyCompany Agent[616] <Error>: kCGErrorCannotComplete
: CGSDeviceSynchronize: Invalid device window
    6/18/10 3:54:59 PM MyCompany Agent[616] kCGErrorCannotComplete :
CGSDeviceSynchronize: Invalid device window
    6/18/10 4:13:52 PM /Library/Application
Support/MyCompany/MyCompany Agent.app/Contents/MacOS/MyCompany
Agent[861] SessionGetInfo(0xb33e40) -> -2147417855
    6/18/10 4:13:52 PM /Library/Application
Support/MyCompany/MyCompany Agent.app/Contents/MacOS/MyCompany
Agent[861] SessionGetInfo(0xb33e40) -> -2147417855
    6/18/10 4:14:32 PM /Library/Application
Support/MyCompany/MyCompany Agent.app/Contents/MacOS/MyCompany
Agent[865] SessionGetInfo(0xb33e40) -> -2147417855
    6/18/10 4:14:32 PM /Library/Application
Support/MyCompany/MyCompany Agent.app/Contents/MacOS/MyCompany
Agent[865] SessionGetInfo(0xb33e40) -> -2147417855
    6/18/10 4:14:42 PM /Library/Application
Support/MyCompany/MyCompany Agent.app/Contents/MacOS/MyCompany
Agent[868] SessionGetInfo(0xb33e40) -> -2147417855


More information about the launchd-dev mailing list