Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ulimit open file handles reached #14

Open
FASTLIKETREE opened this issue Jan 19, 2018 · 0 comments
Open

ulimit open file handles reached #14

FASTLIKETREE opened this issue Jan 19, 2018 · 0 comments

Comments

@FASTLIKETREE
Copy link
Contributor

FASTLIKETREE commented Jan 19, 2018

An issue I hit when writing units tests to check log rotate functionality.

When running logs in a loop Rotate.prototype.log does not check if an existing write stream is already being created for a particular file. Instead it checks for a ready flag asynchronously set by logrotate-stream. This results in calling _init() every time you call Rotate.prototype.log, never giving time for the stream to become ready.

This hits my machine open file handle limit (ulimit -n).

Below is a mocha test that exhibits the issue.

it('max file handles', function(done) {
  this.timeout(10000)
  var temp_dir = temp.mkdirSync('winston-logrotate-test');
  var file = path.join(temp_dir, 'rotate.log');
  var logger = new Rotate({
      file: file,
      size: '1k',
      keep: 1
  });

  for (let i = 0; i < 100000; ++ i) {
    logger.log('max log test');
  }
  done();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant