appfeel / node-pushnotifications

Push notifications for GCM, APNS, MPNS, AMZ (automatic detection from device token)
MIT License
541 stars 127 forks source link

MaxListenersExceededWarning #126

Closed bjoern2610 closed 3 years ago

bjoern2610 commented 4 years ago

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

const results = await push.send(devices, data); console.log('Push results', results);

Why i get memory leak detected?

What i need to change?

alex-friedl commented 4 years ago

Hm, possible duplicate of https://github.com/appfeel/node-pushnotifications/issues/70 ? We thought/hoped the issue was fixed. Which version of the library are you using? the most recent one?

bjoern2610 commented 4 years ago

I have the library node-pushnotifications@1.2.1. I needed to add this to solve error message. But is it the right solution?

require('events').EventEmitter.defaultMaxListeners = 0;

alex-friedl commented 4 years ago

I wouldn't recommend that solution, since it changes the default value for all event emitters in your application (https://nodejs.org/api/events.html#events_eventemitter_defaultmaxlisteners)

Not sure myself how to proceed with this issue. Maybe the warning can even safely be ignored? Do oyu have profiling data on the memory usage of your application?

bjoern2610 commented 4 years ago

Maybe the warning can even safely be ignored?

Can i really ignore this? I have only 12 deviceIds in the DB and sending. If i need to send 10k what will happen?

bjoern2610 commented 4 years ago

Somebody here?

alex-friedl commented 4 years ago

Sorry. From what I understand it's an issue with node-apn and nothing we can fix in this library? Did you open an issue there?

bjoern2610 commented 4 years ago

OK, let me do a request issue on node-apn.

KBSchmidt commented 3 years ago

@bjoern2610 do you still experince this issue with the latest release?

alex-friedl commented 3 years ago

Closing this for inactivity, as it does not seem to be an issue for any other users. Please re-open if issue persists