got android.os.TransactionTooLargeException, it is said because of
“This exception occurs when too much data is transferred via Parcels concurrently. The underlying Binder transaction buffer has a limited fixed size, currently 1Mb, which is shared by all transactions in progress for the process. Consequently this exception can be thrown when there are many transactions in progress even when most of the individual transactions are of moderate size.”
android.os.TransactionTooLargeException: data parcel size 593484 bytes
at android.os.BinderProxy.transactNative(Binder.java)
at android.os.BinderProxy.transact(Binder.java:628)
at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:4132)
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:4159)
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:6692)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
In the time it is crashing the logs shows the mainActivity started onSaveInstanceState() and with a few fragments it contains as well.
583 | 04:46:32:173 (UTC) | MainActivity:onSaveInstanceState()
584 | 04:46:32:174 (UTC) | DataListFragment:onSaveInstanceState()
585 | 04:46:32:174 (UTC) | DrawerFragment:onSaveInstanceState()
586 | 04:46:32:174 (UTC) | DataContainerFragment:onSaveInstanceState()
587 | 04:46:32:174 (UTC) | DataDetailsFragment:onSaveInstanceState()
588 | 04:46:32:175 (UTC) | DataDetailsFragment:onSaveInstanceState()
589 | 04:46:32:175 (UTC) | DataDetailsFragment:onSaveInstanceState()
The mainActivity has a Drawer and a list fragment, when clicking on the list item a container fragment opens which has a viewPage and holds three details fragments.
Looks like the accumulated data has gone over the 1 meg limit of the Binder.
Did a closer look at all of the fragment’s saved data in their onSaveInstanceState() call, they are all small (int, boolean, etc.), adding all together are less than a few k, lets say < 10k.
Also looked at all fragment’s layout files, which uses LiniearLayout, TextView, ImageView, WebView etc. And did a log to see what are the data android View may save.
The log shows all these fragment’s Views altogether may save less than 30k.
So don’t know where this “data parcel size 593484 bytes” is from.
Or there must be some other data android system is also saving (?).
Is there a way to find out or dump the “underlying Binder transaction buffer” data to see what they might be from? Does anyone know what (or how to find) are the data the android is saying for the WebView?
===
Extended the View to do the log, similar ones used for other View used in the fragments
public class LogLinearLayout extends LinearLayout {
public LogLinearLayout(Context context) {
super(context);
}
public LogLinearLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public LogLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void dispatchSaveInstanceState(SparseArray<Parcelable> container) {
super.dispatchSaveInstanceState(container);
for (int i = 0; i < container.size()-1; i++) {
Parcelable val = (Parcelable)container.get(i);
byte[] bytes = val != null ? marshall(val) : null;
String parcelByte = (bytes != null) ? "bytes.length:"+bytes.length : ("val==null");
if(bytes != null) {
//Log container level the bytes.length
}
}
}
@Override
protected Parcelable onSaveInstanceState() {
Parcelable pVal = super.onSaveInstanceState();
byte[] bytes = pVal != null ? marshall(pVal) : null;
String parcelByte = (bytes != null) ? "bytes.length:"+bytes.length : ("val==null");
if (bytes != null) {
//Log the bytes.length of this view
}
return pVal;
}
byte[] marshall(Parcelable parceable) {
Parcel parcel = Parcel.obtain();
parceable.writeToParcel(parcel, 0);
byte[] bytes = parcel.marshall();
parcel.recycle();
return bytes;
}
}