-
Notifications
You must be signed in to change notification settings - Fork 17
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 leak on Supervisor with StarterProcess (DPP-84) #77
base: development
Are you sure you want to change the base?
Fix process leak on Supervisor with StarterProcess (DPP-84) #77
Conversation
When the StarterProcess ChildStart variant is used with dynamic supervision, each cycle of startNewChild + terminateChild/deleteChild leaks a process.
So it is safe for us to kill this At first glance, I thought what we actually wanted here is a finalizer that is guaranteed to kill off the re-starter process "at some point" after the
The alternative to this would be to document this behaviour of One approach that might work here would be to convert the Firstly, we'd need to test that this finalization business works properly for a Secondly, and this is a serious problem: finalisation is useless if/when the You can see now why I was a fussy little kitty when @roman and I were debating how to support local children in the original ticket that introduced I think we have three choices here, as I see it - feel free to suggest alternatives though, as always:
The idea of (1) is that we're avoiding the issue by making the API less friendly. Not a great option IMO. The idea behind (2) is that the re-starter process will keep some internal state to track each time a new supervisor tries to use it. Each time a supervisor deletes a The idea of (3) is that we either find a way to expose that re-starter pid or just make people implement the Thoughts? ...... |
And of course, it'd be really nice if we came up with a way to do "distributed finalization", but that's really beyond the scope of this ticket. :) |
(1) isn't an option for our use case and (2) sounds seriously hard to get right. I think (3) makes most sense. It would still require cleanup of the restarterPid somewhere, but as you say, the developer using dynamic supervision is best positioned to do that correctly. They'd do something like |
Yes I agree that's probably the right thing to do. We could leave it in the -- | Spawns a process that can be used to (re)start child processes
-- when they fail. The `ChildStart` is suitable for use in a `ChildSpec`.
-- Note that once the starter process is no longer used, the caller
-- (of this function) is responsible for cleaning up (i.e., stopping) it.
spawnChildStarter :: Process () -> Process (ProcessId, ChildStart)
spawnChildStarter proc = ... etc |
@hyperthunk I've been experimenting with |
Yeah that sounds good to me. Thanks for all the work you've been putting around this - it's much appreciated! I'll try and get all the outstanding PR's QA'd and merged this week. |
Moved helper functions to where clauses. See the discussion on PR haskell-distributed#77.
This is in preparation for some changes to the handling of the StarterProcess variants of ToChildStart. See discussion on PR haskell-distributed#77.
So.... where are we with this pull request now @tavisrudd ? |
I'm going to have to release without this fix I'm afraid, as I'm on holiday next week and this is the last chance I'm going to have to actually make the release. Let's get this merged when I'm back online (next Friday) and do a patch 0.1.1 release with it in. |
Caveats - unless you can get me a fix in the next few hours.... :) ? |
I won't have time till next week unfortunately. The last few weeks of parenthood and work have been a bit intense and I'm just catching a breath now. Enjoy your holiday! Tavis
|
Hey @tavisrudd - how're you? Do you want me to pick up the fix for this? |
I'm well, but busier than I've ever been with a new kid and new job. I've On Wed, 13 Aug 2014, Tim Watson wrote:
|
Ok @tavisrudd - I'm going to pick this one up now. As you can tell, I've been a bit on the busy side myself! |
Fix https://cloud-haskell.atlassian.net/browse/DPP-84
When the StarterProcess ChildStart variant is used with dynamic
supervision, each cycle of startNewChild + terminateChild/deleteChild
leaks a process.
Note, this required converting
handleDeleteChild
fromRestrictedProcess
toProcess
.