Pushy and container environments

238 views
Skip to first unread message

Jon Chambers

unread,
Sep 4, 2014, 12:36:30 PM9/4/14
to pushy...@googlegroups.com
Hi, everybody!

Right now, we're aware of several issues related to using Pushy in a container environment (e.g. Tomcat). In general, the issues are that Netty, the networking library used by Pushy, creates long-lived threads and `ThreadLocal` instances that are difficult to clean up properly in a container environment. Netty's behavior is the result of deliberate design decisions rather than bugs.

Based on some research and communication with the Netty folks, I'm coming to believe that there isn't a viable technical solution to be had. Although we've said it should be fine in the past, I think our official recommendation may need to change to "don't use Pushy in a container environment if you're worried about things getting cleaned up rigorously."

To be clear, Pushy does and will continue to operate just fine at steady-state in container environments. Its performance and memory profile should look exactly the same as if it were run as a standalone service. The issue is that it may leave persistent resources behind, leading to leaks after your app has shut down. This is largely a non-issue if you shut down your container completely when you're done, but is problematic if you're just shutting down individual apps within your container.

I wanted to give everybody here a heads-up that the container recommendation was changing. Please let us know if you have any questions, concerns, or suggestions.

Thanks!

-Jon

Sean Scott

unread,
Jan 27, 2015, 5:22:45 PM1/27/15
to pushy...@googlegroups.com
Hi Jon,

Our application is a Play Framework application, and thus runs in the Play Framework "container".  Since Play Framework is based on Netty, does the guidance to avoid a container environment still apply?

Thanks

-sean

Sean Scott

unread,
Jan 28, 2015, 11:08:57 AM1/28/15
to pushy...@googlegroups.com
Hi Jon,

I hope you are able to have the time in the near future to respond to my inquiries.

Is this problem related to shutting down Pushy in a long running application?  For example, if I start one up and leave it up until my application exits... or very infrequently shut down Pushy ( like when a certificate is updated )  I won't have a problem?

If not, can you explain what you mean by container?  Is the issue with Servlet Containers in particular?

-sean

On Thursday, September 4, 2014 at 10:36:30 AM UTC-6, Jon Chambers wrote:

Jon Chambers

unread,
Jan 28, 2015, 5:55:18 PM1/28/15
to Sean Scott, pushy...@googlegroups.com
Sean,

Sorry, but I don't know anything about the Play Framework. Generally speaking, if you have an application that uses Pushy and lives "inside" another Java process, you can expect memory leaks because Pushy uses Netty, and Netty creates resources that aren't cleaned up until the JVM exits.

These leaks would only happen if your application finishes, but the parent process continues to run. They will not be a problem during normal operation when, for example, shutting down one PushManager instance and creating another.

If the Play Framework runs on Netty, then I'd suspect things will be fine, but make no guarantees.

-Jon

--
Pushy is an open-source Java library for sending APNs (iOS and OS X) push notifications. Pushy is brought to you by the engineers at RelayRides.
---
You received this message because you are subscribed to the Google Groups "pushy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pushy-apns+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pablo Lombillo

unread,
Feb 6, 2015, 9:15:26 AM2/6/15
to pushy...@googlegroups.com
Hi Jon,
first congrats for your work.
I have a tricky question, in case we run Pushy in a container and we instance it twice form 2 webapps, due to netty would they share anything?
Both webapps are separated because we do not use sharedlibs and so, but i don't know wether netty has some rare behaviour.

We have integrated pushy 0.3 (and 0.4 in a new version of our lib) for a pilot.
Our lib creates a singleton manager that dispatches messages to Pushy and other push libraries through queues, threads and executorservices.
So the manager has one instance of Pushy.
During development and in test scenarios Pushy works great, but we have adopted a complex scenario to run it and we are facing problems.

We are using our library inside 2 webapps running in Tomcat.

What we do is launching a listener on tomcat startup, so we run a servlet that instances our manager (each webapp is supposed to have its own instance of the singleton theoretically..)

Now comes the funny thing. At startup everything works fine, we can send notifications from each webapp...but after a while, stops arriving notifications from one of the webapps, then form the other...then stars again working both...randomly.
Just i want to understand if netty is shared among instances or something like that.
I know we can have scheduling issues and i'm checking all the code, but i'm pretty stuck as unit tests are working like a charm.

I will try to run just an instance an let see if it works better, but i would like to know what i asked before, in case you know the answer :) . 

Thank you in advance and have a nice weekend.
Reply all
Reply to author
Forward
0 new messages