I am trying to write a file copy code in NodeJS.
fse.copy(path + '/' + file, destDir + '/' + site + '/' + file, function(err) {
try {
if (err) {
return callback2(err);
} else {
console.log("moved " + site + '/' + file);
return callback2();
}
} catch (e) {
console.log(e);
return callback2(err);
}
});
});
This works fine except when the file count is high like 70k files. when it comes to such folder with more files, program simply stops.. No error stack or no error message. I am running this on RHEL 6 server. I monitored the files open while the program is running using lsof -p command. this count wont cross 4000 at any time. I guess this is due to the 'ulimit' value in this server which is 4096. I tried adding these statements too
process.on('uncaughtException', (err) => {
console.log(`err : ${err}`);
});
process.on('unhandledRejection', (reason, p) => {
console.log(`reason : ${reason} : pr: ${p}`);
});
Still there is any error message on console or the system logs .'/var/log/messages'
what could be the reason for this behaviour ? I can increase the ulimit on the server but I want to confirm that this is due to this no of files open limit
via Sravan
No comments:
Post a Comment