Page MenuHomePhabricator

Memory leak in node-apn
Open, LowPublicBUG REPORT

Description

This report corresponds to upstream issue https://github.com/node-apn/node-apn/issues/674. There is a memory leak in node-apn (or one of its dependencies).

Steps to Reproduce: Start the service, send a message to APNS through it, and then leave it running for a while (~15 mins).

Results: The following warning is emitted:

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

Observed locally while running with node v10.15.3 on Ubuntu 20.04, and also on the Beta Cluster while running in image 2020-09-16-184730-publish.

Event Timeline

One of the suggestions as a workaround for that issue that doesn't rely in an upstream fix could be :

  • Batch notifications (as we already do)
  • Create an APN client instance on queue flush
  • Destroy after notifications are send

Maybe its worth trying that locally and see if it resolves the memory leak