为什么守护进程会随机停止?
这有点与 我之前的但迄今为止尚未成功的问题。我有一个守护进程放置在 LaunchAgents 文件夹(在 Mac 上)中,它应该在后台永久运行,但几天后它就无缘无故地停止了。我不知道为什么,因此我的问题是:
守护进程可能随机停止的原因是什么?
感谢您的帮助!
This is sort of related to a previous, yet so far unsuccessful question of mine. I have a daemon that is placed in the LaunchAgents folder (on Mac) and it should run perpetually in the background, but after a couple of days it just stops for no apparent reason. I have no idea why and thus my question:
What are the reasons that a daemon might randomly stop?
Thanks for the help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
守护进程只是一个持久(分叉)的进程。守护进程崩溃的原因与任何其他程序崩溃的原因相同:
未分配用于读取或
由该应用程序编写
(分段错误)或 x86 特定的
(一般保护故障)
指令无效
在其执行的硬件设备上
无权访问
调用
应用程序访问的资源
无权访问
(总线错误)
带有错误参数的指令
(取决于CPU架构):
除以零,分母运算
或 NaN 值,内存访问
未对齐的地址等
A Daemon is just a long lasting (forked) process. The reason a Daemon crashes is the same any other program crashes:
that is not allocated for reading or
writing by that application
(segmentation fault) or x86 specific
(general protection fault)
invalid instructions
on hardware devices to which it does
not have permission to access
calls
resources to which the application
does not have permission to access
(bus error)
instructions with bad arguments
(depending on CPU architecture):
divide by zero, operations on denorms
or NaN values, memory access to
unaligned addresses, etc.
由于它是一个 LaunchAgent,因此它作为登录会话的一部分运行,因此如果您注销,它将被终止。
另一方面,如果它在您注销之前就死了,并且您无法找到/修复导致其崩溃/退出的任何原因,或者您可以通过添加
到其 .plist来告诉 launchd 自动重新启动它
Since it's a LaunchAgent, it runs as part of your login session, and hence will be killed if you log out.
On the other hand, if it's dying before you log out, and you can't find/fix whatever is causing it to crash/exit, or you can tell launchd to automatically restart it by adding
to its .plist