pusher / pusher-websocket-android

Library built on top of pusher-websocket-java for Android. Want Push Notifications? Check out Pusher Beams!
MIT License
36 stars 12 forks source link

OutOfMemoryError: Could not allocate JNI Env #40

Closed ghost closed 7 years ago

ghost commented 7 years ago

I am getting OutOfMemoryError so, dependencies: compile 'com.pusher:pusher-java-client:1.4.0' compile 'com.pusher:pusher-websocket-android:0.5.0'

Crash Log: Fatal Exception: java.lang.RuntimeException: java.lang.OutOfMemoryError: Could not allocate JNI Env at com.loopj.android.http.AsyncHttpResponseHandler.onUserException(AsyncHttpResponseHandler.java:304) at com.loopj.android.http.AsyncHttpResponseHandler.handleMessage(AsyncHttpResponseHandler.java:395) at com.loopj.android.http.AsyncHttpResponseHandler$ResponderHandler.handleMessage(AsyncHttpResponseHandler.java:510) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:7230) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) Caused by java.lang.OutOfMemoryError: Could not allocate JNI Env at java.lang.Thread.nativeCreate(Thread.java) at java.lang.Thread.start(Thread.java:1063) at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:921) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1339) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:82) at com.loopj.android.http.AsyncHttpClient.sendRequest(AsyncHttpClient.java:1508) at com.loopj.android.http.AsyncHttpClient.post(AsyncHttpClient.java:1169) at com.pusher.android.notifications.interests.SubscriptionManager.sendSubscription(SubscriptionManager.java:70) at com.pusher.android.notifications.interests.SubscriptionManager.sendSubscriptions(SubscriptionManager.java:48) at com.pusher.android.notifications.PushNotificationRegistration.onSuccessfulRegistration(PushNotificationRegistration.java:186) at com.pusher.android.notifications.tokens.RegistrationListenerStack.onSuccessfulRegistration(RegistrationListenerStack.java:31) at com.pusher.android.notifications.tokens.TokenUpdateHandler.onSuccess(TokenUpdateHandler.java:34) at com.loopj.android.http.AsyncHttpResponseHandler.handleMessage(AsyncHttpResponseHandler.java:351) at com.loopj.android.http.AsyncHttpResponseHandler$ResponderHandler.handleMessage(AsyncHttpResponseHandler.java:510) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:7230) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Can anybody found any solution for this kind of issue?

zmarkan commented 7 years ago

Hi,

I don't think we've had this in the past. What kind of devices are you seeing this on? Any particular Model or Android version?

Is this crash happening a lot?

Thanks!

ghost commented 7 years ago

I had seen on Samsung Galaxy Sol 4G device which has Marshmallow 6.0.1 OS.

zmarkan commented 7 years ago

Thank you for the info, I'll try to reproduce the issue.

zmarkan commented 7 years ago

Are you using FCM or GCM for your push notifications?

ghost commented 7 years ago

We are using FCM for push notification

zmarkan commented 7 years ago

I've been doing some profiling and can confirm we're not leaking any memory there. The OOM errors must have a cause somewhere else.

Have you tried profiling memory usage on your side? Maybe that will give you some more insight into what is happening.

ghost commented 7 years ago

Thank you I will do it Memory Profiling from my side.

zmarkan commented 7 years ago

Cool. Closing the issue for now.