iFixit / dozuki-android

GNU General Public License v3.0
1 stars 0 forks source link

🐞 Android app crashing when in certain categories #22

Open BCKlein opened 5 years ago

BCKlein commented 5 years ago

Background -- Customer [https://ibrightinfo.dozuki.com/] reports that the Android app crashes only when they view guides in a certain category. NZ Guides/NZ LDU 750 Vehicle Guide - Rev 3/(Then any truck/model)

I've verified that it doesn't happen on Cloud but does in the Android app.

Two categories appear to be crashing the Android App. https://ibrightinfo.dozuki.com/c/TMU_750 and https://ibrightinfo.dozuki.com/c/NZ_LDU_750_Vehicle_Guides_-_Rev_3 Both categories has a large amount of guides in them.

To reproduce --

  1. log into their account on the Android app
  2. click NZ Guides
  3. click NZ LDU 750 Vehicle Guides - Rev 3
  4. click on any guide for app to crash

To do

TBD after research

timothyasp commented 5 years ago

Looks like it's a TransactionTooLargeException - which is pretty straightforward to fix and was caused by android Nougat changing the way it handles activity transactions.

Let me know how you'd like to proceed - I'd estimate this to take ~2hrs to fix and deploy.

BCKlein commented 5 years ago

The customer has had the issue for around a month so a fix sooner would be better then later. Maybe @Diakonia7 had an idea on how to proceed?

timothyasp commented 5 years ago

I can get these changes out this week.

BCKlein commented 5 years ago

Thank you! I'll let the customer know.

timothyasp commented 5 years ago

This bug is getting stranger...

The issue happens only when in the production build, not in the dev build. Unclear if this is due to something different with the API responses and data between www.cominor.com and ibrightinfo.dozuki.com

timothyasp commented 5 years ago

I tracked down the issue - unfortunately it's not the GuideViewActivity that's causing the problem.

it's going to take some re-working how we handle the TopicViewActivity and associated fragments to handle very large categories. (like NZ LDU 750 Vehicle Guides - Rev 3) Right now, that category is passed around between the Activity and fragments using the Binder transaction buffer, which has a max 1mb total storage. That category object is 353kb, and there isn't a quick way to cut that down.

There's a couple different approaches to fix this - upgrade the Activity and Fragment to use ViewModels to share the category object between activity and fragments/pager OR Implement some sort of persistence layer in SQLite and pass around references using the Binder transaction buffer.

I'm leaning towards the first option since it seems to be what Google/Android is recommending for this type of thing.

Both of these options will take longer than expected since it's a fairly significant refactor, and unfortunately I won't be able to get this bug fixed this week. The release for this bug will have to be pushed back till early next week since I'll be out of town till Monday.

Airruk commented 5 years ago

It sounds like you're leaning towards that first route @timothyasp - let us know when you're able to work on this and your expected ETA for that fix so we can update the affected customers.

timothyasp commented 5 years ago

I went through my schedule and looked at what it'd take to rewrite this, and it's looking like ETA right now is end of April.

timothyasp commented 5 years ago

Further description from a Slack convo with addison: adding it for context.

The reason this is happening is because we’re using Intents and Bundles to pass data between activities, fragments and adapters after the API response has been returned
this was best practice (well, the only practice) back in 1.6-4.1 days when me and marc actively were developing the app
but in the subsequent 5-7 major version changes, android fully deprecated that method of passing data for anything but very tiny pieces of data
the problem isn’t necessarily with a single large guide or object.  it’s that we’re using that TransactionBuffer to pass all of our small pieces of data, and that buffers memory is managed outside of our control
so sometimes even a medium sized object getting passed into that buffer with overflow it