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

File appender memory leak after reload configure #700

Closed
Cap32 opened this issue Apr 27, 2018 · 6 comments · Fixed by #1110
Closed

File appender memory leak after reload configure #700

Cap32 opened this issue Apr 27, 2018 · 6 comments · Fixed by #1110
Milestone

Comments

@Cap32
Copy link

Cap32 commented Apr 27, 2018

I want to reload / update my configuration, but I get memory leak warning.

  • log4js v2.5.3
  • node.js v8.9.0
  • macOS v10.13.4
const log4js = require('log4js');
const options = {
	appenders: {
		foo: { type: 'file', filename: 'foo.log' },
	},
	categories: {
		default: { appenders: ['foo'], level: 'info' },
	},
};
const loop = (index = 0) => {
	if (index < 11) {
		log4js.configure(options);
		log4js.shutdown(() => loop(++index));
	}
};
loop();

throw:

(node:19311) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGHUP listeners added. Use emitter.setMaxListeners() to increase limit

Or is there any other way to reload / update configuration?

Thanks

@nomiddlename
Copy link
Collaborator

Thanks for raising this - the file appender has a SIGHUP listener leak by the looks of things.

@nomiddlename nomiddlename added this to the 2.6.0 milestone Apr 29, 2018
@nomiddlename nomiddlename self-assigned this Apr 29, 2018
nomiddlename added a commit that referenced this issue Apr 30, 2018
fix: #700 - file appender SIGHUP leak
@nomiddlename
Copy link
Collaborator

Github auto-closed this, but the fix won't be released until version 2.6.0 goes out to NPM - I'm just waiting for a fix for a streamroller bug before I publish.

@lmyzzu
Copy link

lmyzzu commented May 31, 2018

when appender has too much(>=12), It's will emit this error ,but i can't find the reason

@yiu31802
Copy link

yiu31802 commented Dec 4, 2018

This issue still exists with the latest version 3.0.6. It started to appear when the number of appender reached 12.

1 similar comment
@shudingbo
Copy link

This issue still exists with the latest version 3.0.6. It started to appear when the number of appender reached 12.

@lamweili
Copy link
Contributor

This has been patched in PR #1110.

@lamweili lamweili modified the milestones: 2.6.0, 6.4.0 Jan 10, 2022
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

Successfully merging a pull request may close this issue.

6 participants