TimonKK / clickhouse

NodeJS client for ClickHouse
Apache License 2.0
221 stars 122 forks source link

EventEmitter: memory leak detected. Propose change-out deprecated request-library #112

Open 0xgeert opened 2 years ago

0xgeert commented 2 years ago

I'm getting a lot of 'EventEmitter: memory leak detected'-messages, which turn out to be real: process crashes with an OOM after a day or so.

This is due to the request-lib not behaving nicely. https://github.com/request/request/issues/3139. This won't get fixed since request-library is deprecated.

Would you consider changing this out for something more robust, like axios, superagent, fetch?

0xgeert commented 2 years ago

Doesn't solve the underlying issue (OOM still happens), but get rid of the warnings

// Prevent eventEmitter: memory leak detected to be shown. This happens (probably) inside request.js which is used by Clickhouse
// https://github.com/request/request/issues/3139
const EventEmitter = require('events');
EventEmitter.prototype.setMaxListeners(Infinity)