In retrospect, domain.dispose() is probably a bad idea. 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? On Fri, Nov 30, 2012 at 11:42 AM, Forrest L Norvell <[email protected]> wrote: > I've been working on adding domains support to a fairly complex piece of > error-tracing code and am looking for some guidance on what's supposed to > happen when domain.dispose is run. > > In a couple of my exploratory tests, I was disposing of every HTTP server > request and was running into something that felt a lot like a race > condition. domain.dispose fires before all of the writes to the socket > complete or the socket is destroyed, leaving it on the active handle list, > which prevents the process from ever exiting. I understand that dispose is > meant for cleanup in error handlers, but shouldn't it also deal with normal > streams / EventEmitters without leaving handles in a stuck state? Is there > something I'm not getting? > > thanks, > Forrest > > -- > 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 -- 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
