Skip to content

Commit

Permalink
fix(NA): MaxListenersExceededWarning on getLoggerStream (elastic#57133)
Browse files Browse the repository at this point in the history
* fix(NA): possible EventEmitter memory leak detected with a passthrough for getLoggerStream

* chore(na): remove passthrough

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
mistic and elasticmachine committed Feb 10, 2020
1 parent 7e034c4 commit b2ebed2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/legacy/server/logging/log_reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ import LogFormatJson from './log_format_json';
import LogFormatString from './log_format_string';
import { LogInterceptor } from './log_interceptor';

// NOTE: legacy logger creates a new stream for each new access
// In https://github.com/elastic/kibana/pull/55937 we reach the max listeners
// default limit of 10 for process.stdout which starts a long warning/error
// thrown every time we start the server.
// In order to keep using the legacy logger until we remove it I'm just adding
// a new hard limit here.
process.stdout.setMaxListeners(15);

export function getLoggerStream({ events, config }) {
const squeeze = new Squeeze(events);
const format = config.json ? new LogFormatJson(config) : new LogFormatString(config);
Expand Down

0 comments on commit b2ebed2

Please sign in to comment.