Crash on bandwidth settings #9

Closed
opened 2025-04-21 14:44:28 -04:00 by idk · 6 comments
Owner

As reported at http://zzz.i2p/topics/3328
only when router is running
feedback sent, please check gplay.

As reported at http://zzz.i2p/topics/3328 only when router is running feedback sent, please check gplay.
idk added this to the 1.9.0 milestone 2025-04-21 14:44:28 -04:00
idk self-assigned this 2025-04-21 14:44:28 -04:00
idk closed this issue 2025-04-21 14:44:28 -04:00
Author
Owner

Closed with release of 1.8.2

Closed with release of 1.8.2
Author
Owner

Tested upgrade from 1.7.1->master and 1.8.1->master, both work again. Going to tag 1.8.2 and release.

Tested upgrade from 1.7.1->master and 1.8.1->master, both work again. Going to tag 1.8.2 and release.
Author
Owner

Changing settings_net.xml back worked best. I still want to alter this page, but I'll hold off until after the post-mortem on it. Fix is checked in on master. Determined that migrateOldSettings is definitely sabotaging me behind my back.

Changing settings_net.xml back worked best. I still want to alter this page, but I'll hold off until after the post-mortem on it. Fix is checked in on master. Determined that migrateOldSettings is definitely sabotaging me behind my back.
Author
Owner

It may be sufficient to just back out that change to settings_net.xml

... but maybe not. The migrateOldSettings() may be sabotaging you behind your back.

It may be sufficient to just back out that change to settings_net.xml ... but maybe not. The migrateOldSettings() may be sabotaging you behind your back.
Author
Owner

hot on the trail here. Contrary to what you said, we are in the stack trace:

    at net.i2p.android.preferences.NetworkPreferenceFragment.onCreatePreferences(NetworkPreferenceFragment.java:11)

there's clues also in SettingsActivity.migrateOldSettings(), a str4d change from 2016.

Note that a Preferences can contain a String or an int. You do putInt() or putString(), and getInt() or getString(). If you don't get what you put, you'll get a ClassCastException which is of course unchecked and you crash.

That 2016 change also switched from PreferenceFragment to PreferenceFragmentCompat, and migrated the settings accordingly from String to int.

Now to the problematic NetworkPreferenceFragment, extends I2PreferenceFragment extends CustomPreferenceFragment. I see the xml is settings_net.xml. I also see you changed it on May 28, 2022:

    re-do the AndroidSAMSecureSession so it doesn't require me to ask permission to draw over other apps. Permission to draw over other apps gives a
pps the power to take screenshots, so it's a special permission on Android.

-    <com.pavelsikun.seekbarpreference.SeekBarPreference
+    <DropDownPreference

so what's happened seems to be that the type of those entries changed from string to int, but you're trying to get a string? I've long forgotten how preferences work, what the default type is, etc. You might now have yourself hosed here and need a workaround like in SettingsActivity to fix it all up since you'll have to handle both types.

Also confused because I don't see what this change has to do with the checkin comment about draw over other apps. The change was 1 minute before you tagged the 1.8.0 release.

hot on the trail here. Contrary to what you said, we are in the stack trace: at net.i2p.android.preferences.NetworkPreferenceFragment.onCreatePreferences(NetworkPreferenceFragment.java:11) there's clues also in SettingsActivity.migrateOldSettings(), a str4d change from 2016. Note that a Preferences can contain a String or an int. You do putInt() or putString(), and getInt() or getString(). If you don't get what you put, you'll get a ClassCastException which is of course unchecked and you crash. That 2016 change also switched from PreferenceFragment to PreferenceFragmentCompat, and migrated the settings accordingly from String to int. Now to the problematic NetworkPreferenceFragment, extends I2PreferenceFragment extends CustomPreferenceFragment. I see the xml is settings_net.xml. I also see you changed it on May 28, 2022: ```diff re-do the AndroidSAMSecureSession so it doesn't require me to ask permission to draw over other apps. Permission to draw over other apps gives a pps the power to take screenshots, so it's a special permission on Android. - <com.pavelsikun.seekbarpreference.SeekBarPreference + <DropDownPreference ``` so what's happened seems to be that the type of those entries changed from string to int, but you're trying to get a string? I've long forgotten how preferences work, what the default type is, etc. You might now have yourself hosed here and need a workaround like in SettingsActivity to fix it all up since you'll have to handle both types. Also confused because I don't see what this change has to do with the checkin comment about draw over other apps. The change was 1 minute before you tagged the 1.8.0 release.
Author
Owner

This is actually harder to reproduce than it appears at first glance. It only happens if you had an I2P router with the unaltered bandwidth settings menu installed, and you changed the settings, and only after both those conditions are fulfilled, you upgrade to a version with the altered bandwidth menu. Installing fresh works, and if you never changed the bandwidth settings before upgrading, it still works. This SO question https://stackoverflow.com/questions/35877287/android-app-crashes-when-i-add-a-button-to-the-layout-xml-file has information which helps reproduce it and provides a workaround but doesn't do much to elucidate why it happens.

    --------- beginning of crash
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: net.i2p.android.donate.debug, PID: 29124
    java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
        at android.app.SharedPreferencesImpl.getString(SharedPreferencesImpl.java:302)
        at android.support.v7.preference.Preference.getPersistedString(Preference.java:1668)
        at android.support.v7.preference.ListPreference.onSetInitialValue(ListPreference.java:260)
        at android.support.v7.preference.Preference.onSetInitialValue(Preference.java:1594)
        at android.support.v7.preference.Preference.dispatchSetInitialValue(Preference.java:1566)
        at android.support.v7.preference.Preference.onAttachedToHierarchy(Preference.java:1293)
        at android.support.v7.preference.Preference.onAttachedToHierarchy(Preference.java:1305)
        at android.support.v7.preference.PreferenceGroup.addPreference(PreferenceGroup.java:260)
        at android.support.v7.preference.PreferenceGroup.addItemFromInflater(PreferenceGroup.java:181)
        at android.support.v7.preference.PreferenceInflater.rInflate(PreferenceInflater.java:363)
        at android.support.v7.preference.PreferenceInflater.rInflate(PreferenceInflater.java:364)
        at android.support.v7.preference.PreferenceInflater.inflate(PreferenceInflater.java:170)
        at android.support.v7.preference.PreferenceInflater.inflate(PreferenceInflater.java:120)
        at android.support.v7.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:138)
        at android.support.v7.preference.PreferenceFragmentCompat.addPreferencesFromResource(PreferenceFragmentCompat.java:429)
        at net.i2p.android.preferences.NetworkPreferenceFragment.onCreatePreferences(NetworkPreferenceFragment.java:11)
        at android.support.v7.preference.PreferenceFragmentCompat.onCreate(PreferenceFragmentCompat.java:228)
        at android.support.v4.app.Fragment.performCreate(Fragment.java:2414)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1418)
        at android.support.v4.app.FragmentTransition.addToFirstInLastOut(FragmentTransition.java:1195)
        at android.support.v4.app.FragmentTransition.calculateFragments(FragmentTransition.java:1078)
        at android.support.v4.app.FragmentTransition.startTransitions(FragmentTransition.java:117)
        at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2408)
        at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)
        at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2273)
        at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:733)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
I/Process: Sending signal. PID: 29124 SIG: 9
Disconnected from the target VM, address: 'localhost:45115', transport: 'socket'

GPlay dev console was down part of the day. Apparently, the number of users who are affected by this is small compared to the total overall userbase, probably because most of them didn't mess with the default bandwidth settings or haven't tried to re-open that menu again.

This is actually harder to reproduce than it appears at first glance. It only happens if you had an I2P router with the unaltered bandwidth settings menu installed, *and* you changed the settings, and only after both those conditions are fulfilled, you upgrade to a version with the altered bandwidth menu. Installing fresh works, and if you never changed the bandwidth settings before upgrading, it still works. This SO question https://stackoverflow.com/questions/35877287/android-app-crashes-when-i-add-a-button-to-the-layout-xml-file has information which helps reproduce it and provides a workaround but doesn't do much to elucidate why it happens. ``` --------- beginning of crash E/AndroidRuntime: FATAL EXCEPTION: main Process: net.i2p.android.donate.debug, PID: 29124 java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String at android.app.SharedPreferencesImpl.getString(SharedPreferencesImpl.java:302) at android.support.v7.preference.Preference.getPersistedString(Preference.java:1668) at android.support.v7.preference.ListPreference.onSetInitialValue(ListPreference.java:260) at android.support.v7.preference.Preference.onSetInitialValue(Preference.java:1594) at android.support.v7.preference.Preference.dispatchSetInitialValue(Preference.java:1566) at android.support.v7.preference.Preference.onAttachedToHierarchy(Preference.java:1293) at android.support.v7.preference.Preference.onAttachedToHierarchy(Preference.java:1305) at android.support.v7.preference.PreferenceGroup.addPreference(PreferenceGroup.java:260) at android.support.v7.preference.PreferenceGroup.addItemFromInflater(PreferenceGroup.java:181) at android.support.v7.preference.PreferenceInflater.rInflate(PreferenceInflater.java:363) at android.support.v7.preference.PreferenceInflater.rInflate(PreferenceInflater.java:364) at android.support.v7.preference.PreferenceInflater.inflate(PreferenceInflater.java:170) at android.support.v7.preference.PreferenceInflater.inflate(PreferenceInflater.java:120) at android.support.v7.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:138) at android.support.v7.preference.PreferenceFragmentCompat.addPreferencesFromResource(PreferenceFragmentCompat.java:429) at net.i2p.android.preferences.NetworkPreferenceFragment.onCreatePreferences(NetworkPreferenceFragment.java:11) at android.support.v7.preference.PreferenceFragmentCompat.onCreate(PreferenceFragmentCompat.java:228) at android.support.v4.app.Fragment.performCreate(Fragment.java:2414) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1418) at android.support.v4.app.FragmentTransition.addToFirstInLastOut(FragmentTransition.java:1195) at android.support.v4.app.FragmentTransition.calculateFragments(FragmentTransition.java:1078) at android.support.v4.app.FragmentTransition.startTransitions(FragmentTransition.java:117) at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2408) at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2273) at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:733) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) I/Process: Sending signal. PID: 29124 SIG: 9 Disconnected from the target VM, address: 'localhost:45115', transport: 'socket' ``` GPlay dev console was down part of the day. Apparently, the number of users who are affected by this is small compared to the total overall userbase, probably because most of them didn't mess with the default bandwidth settings or haven't tried to re-open that menu again.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: I2P_Developers/i2p.android.base#9
No description provided.