>
> The dispose method destroys a domain, and makes a best effort attempt to 
> clean up any and all IO that is associated with the domain.
>

Are you serious? Close all IO for each failed writeFile or similar library 
call?

On Thursday, June 6, 2013 5:18:15 PM UTC+4, Alex Kocharin wrote:
>
>  
> Probably.
>  
> But I think you can use domains, and domain.dispose() should get rid of 
> such leaks, that's what it was designed for.
>  
> -- 
> // alex
>  
>  
> 06.06.2013, 17:07, "Matthew Larionov" <matth...@gmail.com <javascript:>>:
>
> So It's ok if i call something like
>
> fs.writeFile('some_file', 'data', {encoding: 'utf8', flag : {toString : 
> function(){ throw new Error('oooops');}}}, function(err) { if(err) 
> console.log(err); })
>
> to expect somewhere there would be a resource leak?
>
> On Thursday, June 6, 2013 4:30:13 PM UTC+4, Alex Kocharin wrote:
>
>
> Pretty much all asynchronous code with callbacks relies on a fact that 
> noone throws exceptions here and there. It's simple enough: if there is a 
> callback, don't throw (unless you're working with domains).
>
> But nobody really cares about theoretical "stack exceeded" errors, they 
> are so unlikely to happen with just a few function calls, so it's easier to 
> forget them until they become an issue somewhere. 
>
>
> On Thursday, June 6, 2013 4:08:55 PM UTC+4, Matthew Larionov wrote:
>
> So this code relies on fact there would be no exception in 'writeFile', 
> 'fs.write' or any other called function. And if I try to change those, I 
> should keep in mind that sometimes I can throw exceptions and sometimes I 
> don't, like here:
>
>   if (!Buffer.isBuffer(buffer)) {
>     // legacy string interface (fd, data, position, encoding, callback)
>     callback = arguments[4];
>     position = arguments[2];
>     assertEncoding(arguments[3]);
>  
>     buffer = new Buffer('' + arguments[1], arguments[3]);
>     offset = 0;
>     length = buffer.length;
>   }
>
> assertEncding throws an error, but you just know that there would be a 
> buffer if it is called from 'writeAll'... Is that so?
>
>
> On Thu, Jun 6, 2013 at 2:36 PM, Ben Noordhuis <in...@bnoordhuis.nl> wrote:
>
> On Thu, Jun 6, 2013 at 11:51 AM, Matthew Larionov <matth...@gmail.com> 
> wrote:
> > I was curious what would happen if this exception is being cought.
> > Wonder what would happen to 'fd' - file descriptor - as far as I know 
> there
> > is no such thing as garbage collector for file descriptors or any other
> > resources except memory...
> >
> > Do you really don't see any way for exception to be raised? Just have a 
> look
> > at 'writeAll' function - it's recursive. What would happen if stack is
> > exceeded? I don't understand javascript well actually, but I thought the
> > exception would be thrown.
> The self-recursion only goes one level deep.  writeAll() calls itself
> from inside fs.write(), which is an asynchronous function that runs on
> a fresh stack.
>
> --
> --
> 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 nod...@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> You received this message because you are subscribed to a topic in the 
> Google Groups "nodejs" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/nodejs/gILn3SPCyx4/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to 
> nodejs+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>  
> -- 
> -- 
> 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 nod...@googlegroups.com <javascript:>
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com <javascript:>
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>  
> --- 
> You received this message because you are subscribed to the Google Groups 
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to nodejs+un...@googlegroups.com <javascript:>.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
>
>

-- 
-- 
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 nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to