You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The crash was not related to anything Homebrew, but after it booted back up I noticed Apache wouldn't start. Trying some things, it looks like the PID file it originally created keeps lingering around and Apache itself refuses to start because of it. The same will probably true for any other service that uses PID files on its own.
Some shell output, with extra line breaks to make it a bit more readable:
$ brew services start httpdBootstrap failed: 5: Input/output errorTry re-running the command as root for richer errors.Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/gottemhams/Library/LaunchAgents/homebrew.mxcl.httpd.plist` exited with 5.
$ brew services restart httpdStopping `httpd`... (might take a while)==> Successfully stopped `httpd` (label: homebrew.mxcl.httpd)==> Successfully started `httpd` (label: homebrew.mxcl.httpd)
$ brew services | grep ^httpdhttpd stopped gottemhams ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist
$ /opt/homebrew/opt/httpd/bin/httpd -D FOREGROUNDhttpd (pid 2490) already running
$ echo$?0
$ ps -p 2490 PID TTY TIME CMD 2490 ?? 0:00.25 /System/Library/PrivateFrameworks/DiskImages.framework/Resources/diskimages-helper -uuid C128B
$ cat /opt/homebrew/var/run/httpd/httpd.pid2490
$ rm /opt/homebrew/var/run/httpd/httpd.pid
$ brew services start httpdBootstrap failed: 5: Input/output errorTry re-running the command as root for richer errors.Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/gottemhams/Library/LaunchAgents/homebrew.mxcl.httpd.plist` exited with 5.
$ brew services stop httpdStopping `httpd`... (might take a while)==> Successfully stopped `httpd` (label: homebrew.mxcl.httpd)
$ cat /opt/homebrew/var/run/httpd/httpd.pid cat: /opt/homebrew/var/run/httpd/httpd.pid: No such file or directory
$ brew services start httpd==> Successfully started `httpd` (label: homebrew.mxcl.httpd)
$ cat /opt/homebrew/var/run/httpd/httpd.pid 98579
$ ps -p 98579 PID TTY TIME CMD98579 ?? 0:00.12 /opt/homebrew/opt/httpd/bin/httpd -D FOREGROUND
Since Homebrew does know that the service is not actually running despite there being an actual process with that exact PID, I would presume that it's fairly easy to recognise if the PID file should be removed/emptied upon receiving a start command?
Also notice how I need to explicitly stop the service first, even though brew services already says stopped. I think Homebrew doesn't automatically launchctl bootout when the service previously stopped unexpectedly (or never fully starts up, in this case)? So it tries to execute launchctl bootstrap for a service that's still "active", resulting in that particular error. While technically this makes perfect sense, it's a bit inconsistent with the output of brew services saying it's stopped. You would expect simply brew services start ... to be sufficient.
In case it matters: the version of my homebrew-services is commit 34637816b6d34a6f9414758ceaa410437c4e997c, which should be latest master.
The text was updated successfully, but these errors were encountered:
brew services has never tried to cleanup PIDs on a crash. It would be a good feature request for it to do so, if that's what you're proposing, but to set expectations: it might be a while before anyone who isn't you picks this up and implements it.
Also, yes, Homebrew doesn't automatically run launchctl bootout for you.
brew services is a relatively thin wrapper (on macOS) around launchctl so it doesn't really "automatically" do very much at all.
The crash was not related to anything Homebrew, but after it booted back up I noticed Apache wouldn't start. Trying some things, it looks like the PID file it originally created keeps lingering around and Apache itself refuses to start because of it. The same will probably true for any other service that uses PID files on its own.
Some shell output, with extra line breaks to make it a bit more readable:
Since Homebrew does know that the service is not actually running despite there being an actual process with that exact PID, I would presume that it's fairly easy to recognise if the PID file should be removed/emptied upon receiving a
start
command?Also notice how I need to explicitly stop the service first, even though
brew services
already saysstopped
. I think Homebrew doesn't automaticallylaunchctl bootout
when the service previously stopped unexpectedly (or never fully starts up, in this case)? So it tries to executelaunchctl bootstrap
for a service that's still "active", resulting in that particular error. While technically this makes perfect sense, it's a bit inconsistent with the output ofbrew services
saying it's stopped. You would expect simplybrew services start ...
to be sufficient.In case it matters: the version of my
homebrew-services
is commit34637816b6d34a6f9414758ceaa410437c4e997c
, which should be latestmaster
.The text was updated successfully, but these errors were encountered: