Writing to files in loops seems to be capped at 250 file.write calls. #1
Description
I wrote a simple loop last night to test File I/O and noticed the following behavior. If I created a loop like so:
var times = [];
for (var i=0,j=251; i<j; i++) {
var t1 = Date.now();
var file = new node.fs.File();
file.open('test.log', 'a+');
file.write(i + ' ' + new Date() + ' Hello World!\n');
file.close();
times.push((Date.now() - t1));
}
'file' would contain only 250 new lines of text, while the array 'times' would show it's length to be 1000. The number of new lines added to the file seems fixed at 250. Setting the loop to 249 produced a times array with 249 items and a file with 249 new lines. Setting the loop to 251 produced a times array with 251 items and a file with 250 new lines.
My C++ is very poor, but my guess is that each event has a queue which is hard coded at 250 and my loop over flowed the queue.
Expected:
In a loop you should be able to write to files as much as you like. A web-server that is getting hit many times per second might overflow a 250 limit.