interprocess
interprocess copied to clipboard
Implement more graceful tokio limbo send_off
Hi! First of all, thank you for your work! Interprocess has been very beneficial in my projects so far.
This PR addresses a potential panic in the SendHalf drop implementation and the send_off method The new implementation takes a more graceful approach when attempting to send off the corpse. It falls back to a synchronous bury if there is no active limbo channel and there is no tokio runtime is available.
I also removed the static runtime because I think starting a new runtime in a drop implementation is a bit much hidden cost. The static runtime would also not help in this case because tokio disallows starting a runtime inside a runtime. (even when one is shutting down)
I noticed that most drop implementations in this crate do not bury the corpse directly but send it off either to another thread or here to a tokio runtime. I would not expect much performance (latency) regression with this synchronous bury because this is more a edge-case. But I'm not completly in the picture, do you see it the same way?
Off-topic from this PR: I feel that having that much logic in the drop implemenations is rather bad because there is no way to propagate results back to the crate user. Maybe consider in the future to refactor the bury logic into seperate .shutdown() or .disconnect() methods without implict thread or task spawning. But that looks like no easy task though, so thats another story.
Also note: I left quite a few comments with more details in the repro and in the PR.
Thanks for looking into it! 😊