Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

#16 Remove fs.exists check for reopen #17

Merged
merged 1 commit into from

2 participants

@mratzloff

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.

Matthew Ratzloff 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.
e812463
@bpaquet bpaquet merged commit cce764b into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 9, 2012
  1. Fix #16 - Remove the fs.exists check for handling USR2 signals

    Matthew Ratzloff authored
    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.
This page is out of date. Refresh to see the latest.
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);
Something went wrong with that request. Please try again.