[racket] Custodian behavior on normal exit

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Nov 1 08:44:46 EDT 2013

At Wed, 30 Oct 2013 10:36:34 -0400, Jonathan Schuster wrote:
> On Wed, Oct 30, 2013 at 10:16 AM, Tobias Hammer <tobias.hammer at dlr.de>wrote:
> 
> > Custodians can have entries that are cleaned up on program exit and
> > entries that are only cleaned up whenever a custodian is (regularly) shut
> > down.
> >
> > See 
> http://docs.racket-lang.org/**inside/Custodians.html<http://docs.racket-lang.or
> g/inside/Custodians.html>
> > scheme_add_managed vs. scheme_add_managed_close_on_**exit
> >
> > As far as i can tell the subprocess is added with scheme_add_managed.
> > Patching this to *_close_on_exit changes the behavior to what the OP
> > expect. I'm not sure if close on exit or not is the better default for
> > subprocesses, better ask Matthew what his intentions were.
> >
> 
> Thanks Tobias, it looks like this is the key issue. I'm curious what
> Matthew has to say on it.

I think this change would be good.


> This brings up another question, though. I would expect the custodian to
> shut down all of its managed resources when Racket exits, and not just with
> an explicit shutdown. What are the cases in which one wants to avoid
> shutting down a resource on exit?

The original reason was just to avoid useless work, since everything
originally registered to a custodian was something that an OS would
clean up when a process exits.

At this point, I'm not sure whether anything relies on the current
behavior. I can't think of an example where it would be important to
avoid shutting down a custodian-managed resource on exit, but I'm
inclined to leave things alone, since there is at least a way to get
the always-shutdown behavior for a given resource.


Posted on the users mailing list.