HCaptchaConfig IOException writing serializable object
Hello for some time I'm getting crashes from some of users because of serialization problem. Currently I'm using 3.4.0 version, but it also happened few times on 3.3.6.
Some logs: Fatal Exception: java.lang.RuntimeException Parcelable encountered IOException writing serializable object (name = com.hcaptcha.sdk.HCaptchaConfig)
Fatal Exception: java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.hcaptcha.sdk.HCaptchaConfig)
at android.os.Parcel.writeSerializable(Parcel.java:1714)
at android.os.Parcel.writeValue(Parcel.java:1662)
at android.os.Parcel.writeArrayMapInternal(Parcel.java:875)
at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1579)
at android.os.Bundle.writeToParcel(Bundle.java:1233)
at android.os.Parcel.writeBundle(Parcel.java:915)
at androidx.fragment.app.FragmentState.writeToParcel(FragmentState.java:159)
at android.os.Parcel.writeParcelable(Parcel.java:1683)
at android.os.Parcel.writeValue(Parcel.java:1589)
at android.os.Parcel.writeArrayMapInternal(Parcel.java:875)
at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1579)
at android.os.Bundle.writeToParcel(Bundle.java:1233)
at android.os.Parcel.writeBundle(Parcel.java:915)
at android.os.Parcel.writeValue(Parcel.java:1580)
at android.os.Parcel.writeArrayMapInternal(Parcel.java:875)
at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1579)
at android.os.Bundle.writeToParcel(Bundle.java:1233)
at android.os.Parcel.writeBundle(Parcel.java:915)
at android.os.Parcel.writeValue(Parcel.java:1580)
at android.os.Parcel.writeArrayMapInternal(Parcel.java:875)
at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1579)
at android.os.Bundle.writeToParcel(Bundle.java:1233)
at android.os.Parcel.writeBundle(Parcel.java:915)
at android.os.Parcel.writeValue(Parcel.java:1580)
at android.os.Parcel.writeArrayMapInternal(Parcel.java:875)
at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1579)
at android.os.Bundle.writeToParcel(Bundle.java:1233)
at android.app.IActivityManager$Stub$Proxy.activityStopped(IActivityManager.java:3895)
at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:144)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6912)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:590)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)```
It has occured on 3.5.0 too.
@MMarkiz @vkatzyn maybe you can share more conditions for this issue:
- Android OS versions
- Device models
- How often this happens (total number of cases)
@CAMOBAP it happened over 350 times. OS and device doesn't seem to make difference here. Some users data with crash:
OS version:

Device:

Samsung Devices:

Thank you for reporting this @MMarkiz.
We added more tests for serialization.
A fix was released in version 3.5.1.
@DSergiu I wanted to bring to your attention that although this PR is closed, I am still encountering the same crash with the latest version of HCaptcha. This is reflected in our Firebase crash logs.
@dr-fenil is the stack trace the same? Could you please share some logs and device stats?
@CAMOBAP crash trace Android 13, Device: Realme Narzo 50A
Fatal Exception: android.os.BadParcelableException: Parcelable encountered IOException writing serializable object (name = com.hcaptcha.sdk.HCaptchaConfig) at android.os.Parcel.writeSerializable(Parcel.java:2780) at android.os.Parcel.writeValue(Parcel.java:2546) at android.os.Parcel.writeValue(Parcel.java:2345) at android.os.Parcel.writeArrayMapInternal(Parcel.java:1294) at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1802) at android.os.Bundle.writeToParcel(Bundle.java:1362) at android.os.Parcel.writeBundle(Parcel.java:1363) at android.os.Parcel.writeValue(Parcel.java:2462) at android.os.Parcel.writeValue(Parcel.java:2352) at android.os.Parcel.writeArrayMapInternal(Parcel.java:1294) at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1802) at android.os.Bundle.writeToParcel(Bundle.java:1362) at android.os.Parcel.writeBundle(Parcel.java:1363) at android.os.Parcel.writeValue(Parcel.java:2462) at android.os.Parcel.writeValue(Parcel.java:2352) at android.os.Parcel.writeArrayMapInternal(Parcel.java:1294) at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1802) at android.os.Bundle.writeToParcel(Bundle.java:1362) at android.os.Parcel.writeBundle(Parcel.java:1363) at android.os.Parcel.writeValue(Parcel.java:2462) at android.os.Parcel.writeValue(Parcel.java:2352) at android.os.Parcel.writeArrayMapInternal(Parcel.java:1294) at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1802) at android.os.Bundle.writeToParcel(Bundle.java:1362) at android.os.Parcel.writeBundle(Parcel.java:1363) at android.os.Parcel.writeValue(Parcel.java:2462) at android.os.Parcel.writeValue(Parcel.java:2352) at android.os.BaseBundle.dumpStats(BaseBundle.java:1874) at android.os.BaseBundle.dumpStats(BaseBundle.java:1911) at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:150) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:240) at android.os.Looper.loop(Looper.java:351) at android.app.ActivityThread.main(ActivityThread.java:8370) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:568) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)
device stats
let me know if you need more information.
let me know if you need more information.
@dr-fenil thanks for your patience, I think I need more information.
The issue doesn’t reproduce under standard conditions. Could you please provide more details on the following:
- What is the total number of occurrences of the issue?
- Could you list the Samsung devices affected by the issue?
- Do you have an estimation of how much data (in Kbytes) is saved on activity stop during onSaveInstanceState? (For the activity where the hCaptcha used)
- Are there more details on cause
IOExceptionexception that lead toBadParcelableException
Thanks