Hello guys, I am checking android vitals, and foun...
# support
f
Hello guys, I am checking android vitals, and found an app crash related to Rudderstack library on android in my android app.
Fatal Exception: java.lang.OutOfMemoryError: Failed to allocate a 15120 byte allocation with 7816 free bytes and 7816B until OOM, target footprint 201326592, growth limit 201326592
at android.database.CursorWindow.nativeGetString(CursorWindow.java)
at android.database.CursorWindow.getString(CursorWindow.java:480)
at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:53)
at com.rudderstack.android.sdk.core.DBPersistentManager.getEventsFromDB(DBPersistentManager.java:148)
at com.rudderstack.android.sdk.core.DBPersistentManager.fetchEventsFromDB(DBPersistentManager.java:169)
at com.rudderstack.android.sdk.core.EventRepository.checkIfDBThresholdAttained(EventRepository.java:425)
at com.rudderstack.android.sdk.core.EventRepository.access$1000(EventRepository.java)
at com.rudderstack.android.sdk.core.EventRepository$2.run(EventRepository.java:360)
at java.lang.Thread.run(Thread.java:923)
Sdk Details : 'com.rudderstack.android.sdkcore1.6.1' Any help with it?
m
Hey There! 👋 Your message has been received by the RudderStack team. Our standard customer support hours are 9-6 PM EST, but we will forward this request to your Technical Account Manager, and they will get back to you shortly. Please use the thread for any additional comments.
k
Hey @full-hairdresser-15425, This error means that the app has run out of memory, at what scale are you seeing these kind of errors ?
f
Hey @kind-carpenter-27609 8061 crash events affecting 134 users and Firebase marks it as repetitive ,attached image for reference.
k
Got it, thanks for sharing it, we will take a look at it.
CC <!subteam^S04QT1G74Q3|@sdk-team>
n
@full-hairdresser-15425 can you check for potential memory leaks in the app, using LeakCanary or similar software? The free memory seems to be too low.
f
Sure will check and get back.
@narrow-wolf-10290 We have found some Leaks, fixed them. Was going through crash logs had following observations : build crashed within 2 minutes again due to low memory for a user . (data from Firebase, this data is from a build which had few memory leak issues.) Can we check if ,something memory intensive is happening while processing events. -- One more thing we are mostly seeing these oom crashes occuring from ruddersdk. let me know we can connect also.
k
Hey @full-hairdresser-15425, Rudderstack SDK uses sqlite DB under the hood to store events as they were triggered by the client and batches them and sends them to the Data Plane, and this was the only major memory intensive operation that the SDK does. And from the logs you had shared above, the reason for the OOM is because android cannot find any memory while Rudderstack SDK is trying to read events data from the internal DB and batch them to send to your data plane. This looks more like a memory issue by your app and do you have any information after fixing these memory leaks ?
f
We are rolling out the app version with fix. One more thing to note here, while we are having other analytics sdk like segment, we are not getting any such OOM from there. What is your batch size ?
k
The default value of batch size is
30
. Also, please update to the latest version of Android SDK which is
1.9.0
f
Okay, i see the latest stable is 1.12.0 here. We will be doing it this week.
k
Apologies for the confusion here, please upgrade to
1.12.0
itself.
✅ 1
c
Hey @full-hairdresser-15425, Can you please let us know if the issue has been resolved or not?
f
We are still seeing OOM Issues. Moved to the latest sdk 1.12.0
@kind-carpenter-27609 @calm-yak-10773 @narrow-wolf-10290 I was monitoring room database, saw one very weired logs from rudderstack. Seeing 2 queries getting executed every 1 sec. Why is it so, even when the phone is idle and the app is in the background.Please check
Copy code
2023-04-25 16:46:10.351 13420-19744 RudderSDK               com...kalpe.android.khatabook.debug  D  Debug: DBPersistentManager: getDBRecordCount: countSQL: SELECT count(*) FROM events;
2023-04-25 16:46:10.352 13420-19744 RudderSDK               com...kalpe.android.khatabook.debug  I  Info: DBPersistentManager: getDBRecordCount: fetched count from DB
2023-04-25 16:46:10.353 13420-19744 RudderSDK               com...kalpe.android.khatabook.debug  D  Debug: DBPersistentManager: fetchEventsFromDB: selectSQL: SELECT * FROM events ORDER BY updated ASC LIMIT 30
2023-04-25 16:46:10.355 13420-19744 RudderSDK               com...kalpe.android.khatabook.debug  I  Info: DBPersistentManager: fetchEventsFromDB: DB is empty
2023-04-25 16:46:11.357 13420-19744 RudderSDK               com...kalpe.android.khatabook.debug  D  Debug: DBPersistentManager: getDBRecordCount: countSQL: SELECT count(*) FROM events;
2023-04-25 16:46:11.358 13420-19744 RudderSDK               com...kalpe.android.khatabook.debug  I  Info: DBPersistentManager: getDBRecordCount: fetched count from DB
2023-04-25 16:46:11.359 13420-19744 RudderSDK               com...kalpe.android.khatabook.debug  D  Debug: DBPersistentManager: fetchEventsFromDB: selectSQL: SELECT * FROM events ORDER BY updated ASC LIMIT 30
2023-04-25 16:46:11.360 13420-19744 RudderSDK               com...kalpe.android.khatabook.debug  I  Info: DBPersistentManager: fetchEventsFromDB: DB is empty
2023-04-25 16:46:12.361 13420-19744 RudderSDK               com...kalpe.android.khatabook.debug  D  Debug: DBPersistentManager: getDBRecordCount: countSQL: SELECT count(*) FROM events;
n
@full-hairdresser-15425 the current architecture is based on two services, one that inserts events in the database, other one polls events count every second to check for the polling interval and batch size. One more query, was there any memory leak that was leading to the Rudderstack SDK? Are you seeing OOM issues in your App, after you fixed the memory leaks? Did you see any drop in the number of issues?
f
@narrow-wolf-10290 Could Not find any Memory Leak Leading to RudderStack SDK. There were few memory Leaks in our code. After fixing them and upgrading to latest sdk, after doing some comparison cannot say if OOM Crashes have decreased. Broadly they look the same. Sharing some more stats : Crashlytics says some 90% of these OOM crashes happen in background. The OOM logs we are getting from crashlytics has the same function getEventsFromDB of DBPersistentManager , the same was yesterday shown in sqlite query logs also. Can it be possible that polling every sec is leading to Something. Is it possible to reduce the polling interval from 1 sec to say 30 sec ? Let me know we can connect on a call as well.
@narrow-wolf-10290 @calm-yak-10773 @kind-carpenter-27609 Any thoughts on the above ?
k
Hey @full-hairdresser-15425, As of now there isn’t a way to reduce the polling interval on DB from 1 sec to 30 sec, but I will forward this feature request to the team and let you know what we will do on this.
But the logs you were seeing while the app is in background regarding getEventsFromDB, they aren’t any error logs right ? They aren’t causing the crashes you are seeing right ?
CC <!subteam^S04QT1G74Q3|@sdk-team>
f
@kind-carpenter-27609 @narrow-wolf-10290 @calm-yak-10773 Still we are seeing this issue. Have a clue when this crash can happen. Can we discuss the same ? cc : @purple-byte-68266 @tall-country-16583
k
Hey @full-hairdresser-15425, We are about to push a release this monday with fixes for few issues which could potentially affect performance. And if you are having some information on how this can happen, yes we are happy to discuss this with you and then try our best to resolve this for you
f
We can sync up now or u can suggest some time.
k
I will schedule a meeting for monday/tuesday please let me know your availability timings and who all need to be on the call, I will discuss with the team internally and schedule one.
f
Okay Works. Please add rahul.ranjan@khatabook.com , vikas@khatabook.com , harsh.jha@khatabook.com. 3-4 pm on monday/tuesday would be great.
k
@full-hairdresser-15425, I’ve just sent an invite for 3-4 PM today
✅ 1
Hey @full-hairdresser-15425, We’ve released version 1.15.0 of the Android SDK yesterday here with few performance improvements and fixes for memory leaks, can you please try this and let us know how it works you ?
f
Noted. Apart from this i had to send few userId for whom app was continuously crashing and event not flowing, will be sending them shortly.
k
Sure, thank you
f
@kind-carpenter-27609 @narrow-wolf-10290 @calm-yak-10773 Users for whom we are seeing out of memory crash and event not flowing through rudder to any of the destinations. 1.c6b00226-130b-41b7-b22d-b82fa16d1464 2. b3e89762-3284-4e0a-b6fc-0cee56478196 Note : For all users whom we are getting crashes, not seeing events flowing through rudder at any of the destinations. One More thing checked Google-Analytics(which events are sent via firebase SDK), we are receiving events for these users. In case you want more users will share them, Please take a look why the event also is not flowing,these are active users and use the app everyday. One more question are you able to track crashes which occur inside Rudder-SDK ? Will upgrade the Rudder-Version in this or next week release as asked above to 1.15.0
k
Can you please upgrade to 1.17.0, which is latest as of now.
f
Okay, Sure
Will be shipping the Build with upgrade next thursday, so should have data by late next week.
@kind-carpenter-27609 @narrow-wolf-10290 @calm-yak-10773 Were you guys able to check for the above two IDs? Can it be possible that api request to upload data for these two userIds/RudderIds are erroring out and this has resulted in lot of data in this user local database and hence the OOM ? Just wanted to check the possibility.
@narrow-wolf-10290 @kind-carpenter-27609 Please check and let us know about the below After upgrading to 1.17.0 getting 2 new crashes related to rudder-sdk 1. Fatal Exception: java.util.concurrent.RejectedExecutionException: Task s.h@9a6f07 rejected from java.util.concurrent.ThreadPoolExecutor@feb18f2[Running, pool size = 1, active threads = 1, queued tasks = 128, completed tasks = 16]. -> affecting 1 users on 0.1% Rollout 2. Fatal Exception: android.database.sqlite.SQLiteException: no such table: metrics (code 1): , while compiling: SELECT * FROM metrics LIMIT 10. -> affecting 1 users on 0.1% rollout.
n
@full-hairdresser-15425 are you using any proguard rules? Can you provide details of the user like the device model, os version, etc.
f
Yes we are using progaurd. 1st crash Realme 6Pro Android 11. 2nd crash Nexus 5X Android 6.0.1
n
@full-hairdresser-15425 can you share us the proguard file? You may remove the ones concerning your app internals. We are mainly concerned with the third party libraries and rudderstack proguard rules.
f
Should we do a huddle ? if that helps ?
n
I think, you can send it for now, we need to take a look at it, then if required, we can schedule a call.
f
Sending you as a DM.
n
That will be awesome. Thanks.
f
Got one new Crash . These crashes are coming on 0.5% . Any suggestions on what should we do to unblock our release ? Should we downgrade the sdk version? @narrow-wolf-10290 @kind-carpenter-27609
n
If possible please downgrade, till we come up with the proguard rules.
f
I am hoping in that case no db, migrations would have been done from your side when we migrated from 1.12.0. Otherwise migrations also need to be handled. Please confirm.
n
Migrations are handled.
✅ 1
f
@narrow-wolf-10290 Can we upgrade the sdk now, earlier we had upgraded to 1.17.0, but due to stability issues we had to downgrade. Let us know.
n
@full-hairdresser-15425 we are making a release today. We will let you know post our sanity testing.
@full-hairdresser-15425 we have released 1.20.0. Please try it and provide your feedback
f
Yes @narrow-wolf-10290 sorry for missing this message. Can we move to 1.21.1/1.21.0 ? Let me know
n
It's better to move to 1.21.1
f
Sure thanks. I saw rudderstack has released some progaurd rules as well to add , We should include them too right ?
n
In the latest version proguard rules are bundled.
f
Okay so not needed to add any extra thing in app level rules.pro. Thanks.
@narrow-wolf-10290 Getting one new crash 3 times to 2 user : on upgrading to 1.21.1 with release at 1%. Please check and suggest how to go about it. DefaultPersistence.rawQuery
Fatal Exception: android.database.sqlite.SQLiteException: no such column: status (code 1): , while compiling: SELECT * FROM events WHERE status IN (0, 1) ORDER BY updated ASC LIMIT 30
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(SQLiteConnection.java) at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:887) at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:498) at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588) at android.database.sqlite.SQLiteProgram.init(SQLiteProgram.java:58) at android.database.sqlite.SQLiteQuery.init(SQLiteQuery.java:37) at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44) at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1316) at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1255) at com.rudderstack.android.sdk.core.persistence.DefaultPersistence.rawQuery(DefaultPersistence.java) at com.rudderstack.android.sdk.core.DBPersistentManager.getEventsFromDB(DBPersistentManager.java:319) at com.rudderstack.android.sdk.core.DBPersistentManager.getEventsFromDB(DBPersistentManager.java:299) at com.rudderstack.android.sdk.core.DBPersistentManager.fetchCloudModeEventsFromDB(DBPersistentManager.java:357) at com.rudderstack.android.sdk.core.RudderCloudModeManager$1.run(RudderCloudModeManager.java:50)
@kind-carpenter-27609 @narrow-wolf-10290 @calm-yak-10773 ^
Hello @narrow-wolf-10290 our release is stuck due to this no of crashes have increased, please let us know if we can downgrade to Rudder earlier stable version 1.12.0 and unblock our release. Let us know if we you want to connect for further logs.
n
@full-hairdresser-15425 give us a moment to check. Which version are you upgrading from? Is it 1.12.0?
f
1.12.0 to 1.21.1
👀 1
@narrow-wolf-10290 Any breakthrough on the above?
Hello @narrow-wolf-10290 any ETA for the Fix or should we downgrade the version to get unblocked?
c
Hey @full-hairdresser-15425, We have identified the root cause of this issue and currently exploring the possible solution for it. ETA would be either this Thursday or early next week. If it is urgent you may downgrade but we would suggest to wait for the fix. CC: @narrow-wolf-10290
f
Noted @calm-yak-10773. We have decided to wait for now.
👍 1
@calm-yak-10773 @narrow-wolf-10290 Is there any risk in downgrading/rollback to 1.12.0 you see ?
n
We need to test the downgrade before confirming. @calm-yak-10773 will it be possible to take this up to unblock Rahul?
c
Sure, I’ll do that and get back shortly.
✅ 1
Hey @full-hairdresser-15425, You may proceed with the downgrade. I have tested the downgrade from v1.21.1 to v1.12.0 and found it to be safe. Also, as a precaution, I want to mention that you should not be utilising features like DBEncryption, as they were not part of v1.12.0. Otherwise you may face data loss on downgrading. You can find the complete list of features over here: https://github.com/rudderlabs/rudder-sdk-android/blob/develop/CHANGELOG.md.
f
thanks, @calm-yak-10773 @narrow-wolf-10290. We are not using anything like DBEncryption etc, We just upgraded the no from 1.12.0 to 1.21.1
c
Then you are safe to downgrade.
✅ 1
Hey @full-hairdresser-15425, The fix has been implemented in version 1.21.3. Please update to this version. CC: @narrow-wolf-10290
f
@calm-yak-10773 We have just released by downgrading , will attempt this in next 2 weeks again.
👍 1
c
Sure.