Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix #16 - Remove the fs.exists check for handling USR2 signals

When running multiple processes that are writing to the same log
(not clustered), there is a race condition where the first process
to handle the signal will reopen the file handle (creating the
file), and all other processes will ignore the request because the
file already exists.  This fixes that issue.
  • Loading branch information...
commit e8124636e6dd88e69aac8a1f5fae39e7c61d5470 1 parent bb1e8b5
Matthew Ratzloff authored
Showing with 1 addition and 5 deletions.
  1. +1 −5 lib/log4node.js
View
6 lib/log4node.js
@@ -69,11 +69,7 @@ function Log4Node(config) {
this.file = config.file;
this.reopen();
sig_listener.on('SIGUSR2', function() {
- fs.exists(this.file, function(exists) {
- if (!exists) {
- this.reopen();
- }
- }.bind(this));
+ this.reopen();
}.bind(this));
this.stream.on('error', function(err) {
console.warn('Unable to write into file : ' + this.file + ' ' + err);
Please sign in to comment.
Something went wrong with that request. Please try again.