On Fri, Nov 30, 2012 at 3:58 PM, Isaac Schlueter <[email protected]> wrote:

> In retrospect, domain.dispose() is probably a bad idea.
>

The name doesn't help -- it makes it sounds like the caller is disposing of
the domain (i.e. freeing up memory and resources) rather than trying to
clean up the associated I/O actions. The documentation is clear enough, but
it takes a close read to understand what exactly the function is doing.


> The idea was originally to have some safe way to "discard" all
> outstanding IO operations for a given domain, once it's in a bad
> state.  But that really only made sense when domains were conceived as
> a shared-nothing erlang-esque thing, which it turns out is not very
> easy or fast to do in JS.  So, as it is, domain.dispose() just tries
> to smash all its explicitly bound emitters with a hammer that calls
> .destroy() .close() .end() .destroySoon() etc.
>
> I think we could make dispose() just a "Exit this domain, and also
> ignore all future errors" and that'd be fine, but it sends a message
> that it's a way to clean up resources, which it isn't.
>
> Maybe we should just remove that function entirely?  Anyone else have
> feelings about this?


As somebody writing tooling, I would really like to be able to ensure that
all of the dangling references related to a failed request are cleaned up.
Fail-fast and killing and restarting a service whenever it gets into an
undefined state is a good idea, but I've seen enough abuse of
uncaughtException over the last couple years to know that people will go to
great lengths to brute force themselves into some very bad place just to
avoid an unplanned restart. It would be nice if there were a way to make
that less dangerous as a module author.

Domains take on a lot of the hard work of tracking the handles and EEs put
into play in a certain context, and it would be nice if there were a
convention to shut down and clean all of those resources when things go
haywire. I do agree that the current heuristic approach doesn't inspire a
lot of confidence. Maybe get rid of that part and keep the rest?

F

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to