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

Shut down APN client on send completion - fix memory leak #55

Merged
merged 2 commits into from
Apr 6, 2018

Conversation

shackpank
Copy link
Contributor

Probably related: #47 , #44
Reopen of #54 from a different branch of the fork

The below graph is memory usage of our application, before and after applying this patch
screen shot 2017-06-23 at 08 43 40

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 8363a62 on shackpank:apn_client_shutdown into 8035461 on appfeel:master.

@flipace
Copy link

flipace commented Aug 25, 2017

any idea when this will be merged?

@0x62
Copy link

0x62 commented Oct 13, 2017

Bumping @appfeel

@AdamZikmund
Copy link

Please merge it @appfeel

@c0d3m3nt0r
Copy link

c0d3m3nt0r commented Nov 2, 2017

To create a new connection per each push notification message it's not a good practice (see: https://goo.gl/gi3gud), connections between the Provider and APNS need to be persistent; if you have a scenario in which multiple push notifications are created (along with network connections) in a short period of time, the resulting amount of connections could be interpreted by Apple as a DDoS attack. Does it make sense?. Thanks!

@shackpank
Copy link
Contributor Author

@c0d3m3nt0r Agree, although this pull request does not change that - currently, a new connection is already made per push message, it is just not closed after it's been sent. I guess we (as well as others on this thread) send enough pushes that our server process alerts on memory usage, but not enough for Apple to consider the number of connections opened a problem. If you're working with higher volumes I suspect you're better off using the underlying apn library directly to ensure you get the most out of each instance/open connection and handling the per-platform differences yourself.


As an aside, I've got this pull request published as a scoped package, in case this helps anyone while it's not yet merged into the mainline:

"@shackpank/node-pushnotifications": "1.0.18",

@santiq
Copy link

santiq commented Dec 11, 2017

Bumping @appfeel

@0x62
Copy link

0x62 commented Dec 11, 2017

@miqmago Please merge

@kolya182
Copy link

kolya182 commented Feb 25, 2018

Server goes nuts, @appfeel please merge.
screenshot 2018-02-25 13 18 52

@alex-friedl alex-friedl merged commit 4497611 into appfeel:master Apr 6, 2018
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 this pull request may close these issues.

None yet

10 participants