0

I am stumped on this particular issue and could really use some help.

The movie detail screen of my application receives two integers from the MainActivity through an intent. One of those integers is the unique ID that is used to query the SQLite database, which is stored on the user's device, for the full details of the movie chosen by the user.

When the database reaches 35-40 movies a TransactionTooLargeException error will occur and crash my application. After some thorough testing, I am unable to find why this error is occurring.

What I know: the error occurs after the DB is queried and after the UI is updated with the details from the DB's query (see below for the error stack).

Can anyone help me figure out why this error is occurring?

06-25 22:12:21.099 29350-29350/jkaps9.movieapp E/LC: Main onCreate
06-25 22:12:22.315 29350-29350/jkaps9.movieapp E/MovieFragment: Num movies: 40
06-25 22:12:31.891 29350-29350/jkaps9.movieapp E/LC: MovieAdapter - sending intent to detail
06-25 22:12:31.930 29350-29350/jkaps9.movieapp E/LC: Main onPause
06-25 22:12:32.053 29350-29350/jkaps9.movieapp E/LC: Detail onCreate
06-25 22:12:32.222 29350-29350/jkaps9.movieapp E/LC: Detail onResume
06-25 22:12:32.314 29350-29350/jkaps9.movieapp E/DB: querying DB for movie details
06-25 22:12:32.378 29350-29350/jkaps9.movieapp E/Detail: Getting movie from DB
06-25 22:12:32.378 29350-29350/jkaps9.movieapp E/Detail: Updating UI with movie details
06-25 22:12:32.383 29350-29350/jkaps9.movieapp E/Detail: Finished updating UI with movie details
06-25 22:12:32.415 29350-29350/jkaps9.movieapp E/ViewRootImpl: sendUserActionEvent() mView == null
06-25 22:12:32.505 29350-29350/jkaps9.movieapp E/ViewRootImpl: sendUserActionEvent() mView == null
06-25 22:12:33.200 29350-29350/jkaps9.movieapp E/JavaBinder: !!! FAILED BINDER TRANSACTION !!!  (parcel size = 532192)
06-25 22:12:33.201 29350-29350/jkaps9.movieapp E/AndroidRuntime: FATAL EXCEPTION: main

Process: jkaps9.movieapp, PID: 29350
java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 532192 bytes
    at android.app.ActivityThread$StopInfo.run(ActivityThread.java:4211)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6688)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
 Caused by: android.os.TransactionTooLargeException: data parcel size 532192 bytes
    at android.os.BinderProxy.transactNative(Native Method)
    at android.os.BinderProxy.transact(Binder.java:628)
    at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:4132)
    at android.app.ActivityThread$StopInfo.run(ActivityThread.java:4203)
    at android.os.Handler.handleCallback(Handler.java:751) 
    at android.os.Handler.dispatchMessage(Handler.java:95) 
    at android.os.Looper.loop(Looper.java:154) 
    at android.app.ActivityThread.main(ActivityThread.java:6688) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358) 
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
  • Seems like your db query is sending back too much data.. You may need to change your db structure or try and retrieve fewer rows at a time. See https://stackoverflow.com/questions/11451393/what-to-do-on-transactiontoolargeexception – ashkhn Jun 26 '17 at 02:49
  • I am only retrieving 1 row from the DB at a time. Granted, the one row does contain a significant amount of data, I don't understand why I am only facing the issue once the DB reaches a certain size. To put in perspective my issue, say a user has the movie "Jaws" on their list. If it's the only movie on their list and they click on the movie will get the details and the app won't crash. However, if they have 40 or so movies on their list and they click on "Jaws" (same movie) the detail will load, and then the app will crash. –  Jun 26 '17 at 03:31
  • what BLOBs are you using in your database? – pskink Jun 26 '17 at 03:34
  • See below for my table creation code. I am storing data as the JSON it is downloaded as for ease of transferring the data to Firebase in the future. `String CREATE_MOVIES_TABLE = "CREATE TABLE " + TABLE_MOVIES + " (" + KEY_ID + " INTEGER PRIMARY KEY, " + KEY_JSON + " STRING, " + KEY_RATING + " FLOAT" + ")";` –  Jun 26 '17 at 03:42
  • and what does `KEY_JSON` contain? is it a huge string? more than 1MB maybe? – pskink Jun 26 '17 at 03:48
  • It is a large string, potentially bigger than 1MB, but again the error only occurs when the DB reaches 35-40 rows. Even if I try to pass the same movie before and after (e.g. the string size would be the exact same). –  Jun 26 '17 at 03:50
  • You need to change your db structure and possibly break it into multiple related tables. As to why it only happens only on 35-40 rows, it's probably because the size crosses the limit for those rows. Check the link @pskink posted for information about why this exception occurs – ashkhn Jun 26 '17 at 04:02
  • I am willing to change the structure of my DB if it will get me to a solution. But I am confused as to why the error doesn't occur if I have 1 movie in the DB and try to pull its data but does occur when I have multiple movies in the DB and try to pull the SAME movie that doesn't cause the error. Just doesn't add up to me –  Jun 26 '17 at 04:08
  • Changing the DB structure seems to be working. FYI for those looking for a solution here –  Jul 01 '17 at 13:27

0 Answers0