-
Notifications
You must be signed in to change notification settings - Fork 805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix process killing #1230
Fix process killing #1230
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@louis030195 would a video suffice? |
i had some thoughts on this lately i wonder if we can somehow "inject" something to tell pipes ( not familiar how other software do it, there must be some best practice? for example if you kill screenpipe with CLI or activity monitor you'll have bunch of also i was wondering what is o3-mini answerhere's a deep dive: process supervision fundamentalswhen you design a system with child processes (like pipes written in bun/node) that rely on a parent (screenpipe) api being alive, you need a strategy to detect when that parent has died. common techniques include:
the core idea is that the child process “injects” a self-check. it determines whether it should continue running or self-terminate if it loses connectivity with the controlling process. implementing the self-check in a bun/node contextfor processes written in bun (or node) the approach typically involves periodic pings or even establishing a persistent communication channel (e.g., via sockets). if the channel drops or the ping fails, the pipe can decide to exit. for example, using a simple setInterval that checks the api's status can be effective. ensure that the check is robust; if you rely solely on a unidirectional signal (i.e., just sending a ping without handling network glitches) you risk false positives. a more robust option is to implement a two-way handshake protocol (e.g., some message acknowledgement) so that the child is certain the api is down. this minimizes the risk of false shutdowns due to transient failures. why node is still in the picturebun aims to be a drop-in replacement for node. however:
this mix is not uncommon in modern js environments. essentially, bun is replacing node gradually, but a full migration is rare because existing code and libraries may have critical dependencies on node’s runtime environment. best practices for your contextgiven your pipeline (screenpipe api plus pipes in bun/node):
summary
although implementing these techniques might seem to complicate the architecture, it ultimately increases the robustness and reliability of your system—minimizing orphaned processes and ensuring a graceful shutdown when the primary control is lost. #process-supervision #nodejs #bun #system-design |
/claim #1226
/closes #1226
@louis030195 Turns out in some places it was calling an non-existent function "kill_all_screenpipes", because the actual function was "kill_all_sreenpipes", renamed it and the calls, also uses a better method for terminating Windows processes properly.