mozilla / MozStumbler

Android Stumbler for Mozilla
http://location.services.mozilla.com
Mozilla Public License 2.0
621 stars 214 forks source link

XPosed causes intermittent problems #1485

Open crankycoder opened 9 years ago

crankycoder commented 9 years ago

I've installed xposed to see if I could reproduce some of the issues that we've been reported.

With just the xposed framework and PlayPermissionsExposed installed, I should have no conflicts with the Stumbler, but I appear to. This crash came about while testing the DemoStumbler which is a example application harness for stumbler library.

The crash happened the instant Strava finished installing from the Google Play Store.

I have not been able to reproduce it with uinstall/reinstall of Strava with the DemoStumbler either running or in a force-stop state.

Trying to see if we can get a response over on XDA: http://forum.xda-developers.com/xposed/modules/programmatically-detecting-xposed-t3030121

E/AndroidRuntime(31483): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.crankycoder.demostumbler/com.crankycoder.demostumbler.MainActivity}: java.lang.RuntimeException: Error loading [org.mozilla.mozstumbler.svclocator.services.log.DebugLogger] class
E/AndroidRuntime(31483): >--at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2212)
E/AndroidRuntime(31483): >--at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2271)
E/AndroidRuntime(31483): >--at android.app.ActivityThread.access$800(ActivityThread.java:144)
E/AndroidRuntime(31483): >--at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
E/AndroidRuntime(31483): >--at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(31483): >--at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime(31483): >--at android.app.ActivityThread.main(ActivityThread.java:5146)
E/AndroidRuntime(31483): >--at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(31483): >--at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(31483): >--at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
E/AndroidRuntime(31483): >--at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
E/AndroidRuntime(31483): >--at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
E/AndroidRuntime(31483): >--at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(31483): Caused by: java.lang.RuntimeException: Error loading [org.mozilla.mozstumbler.svclocator.services.log.DebugLogger] class
E/AndroidRuntime(31483): >--at org.mozilla.mozstumbler.svclocator.ServiceConfig.load(ServiceConfig.java:19)
E/AndroidRuntime(31483): >--at com.crankycoder.demostumbler.MainActivity.onCreate(MainActivity.java:30)
E/AndroidRuntime(31483): >--at android.app.Activity.performCreate(Activity.java:5231)
E/AndroidRuntime(31483): >--at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
E/AndroidRuntime(31483): >--at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2169)
E/AndroidRuntime(31483): >--... 12 more
crankycoder commented 9 years ago

Just got another one of these on a different line of code. I think we just have to not run with xposed.

Since the code is a moving target, for reference, these are crashing on these lines in ScanManager.

        mWifiScanner.start(ActiveOrPassiveStumbling.PASSIVE_STUMBLING);
        mCellScanner.start(ActiveOrPassiveStumbling.PASSIVE_STUMBLING);

Crash log below:

W/dalvikvm(20994): threadid=1: thread exiting with uncaught exception (group=0x4166edb8)
E/AndroidRuntime(20994): FATAL EXCEPTION: main
E/AndroidRuntime(20994): Process: com.crankycoder.demostumbler, PID: 20994
E/AndroidRuntime(20994): java.lang.NullPointerException
E/AndroidRuntime(20994): >--at org.mozilla.mozstumbler.service.stumblerthread.scanners.ScanManager.newPassiveGpsLocation(ScanManager.java:120)
E/AndroidRuntime(20994): >--at org.mozilla.mozstumbler.service.stumblerthread.scanners.GPSScanner.onLocationChanged(GPSScanner.java:205)
E/AndroidRuntime(20994): >--at android.location.LocationManager$ListenerTransport._handleMessage(LocationManager.java:279)
E/AndroidRuntime(20994): >--at android.location.LocationManager$ListenerTransport.access$000(LocationManager.java:208)
E/AndroidRuntime(20994): >--at android.location.LocationManager$ListenerTransport$1.handleMessage(LocationManager.java:224)
E/AndroidRuntime(20994): >--at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(20994): >--at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime(20994): >--at android.app.ActivityThread.main(ActivityThread.java:5146)
E/AndroidRuntime(20994): >--at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(20994): >--at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(20994): >--at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
E/AndroidRuntime(20994): >--at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
E/AndroidRuntime(20994): >--at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
E/AndroidRuntime(20994): >--at dalvik.system.NativeStart.main(Native Method)
D/LogFetchServiceManager( 3290): Received entry added
Djfe commented 9 years ago

I'm using xposed and I never had any issues like these (with mozstumbler itself) ->I cannot believe that the setup with using the library will change that much :/

what does the xposed log say? (in the installer app)

what happens with a clean xposed install? no modules at all, just in case -> maybe your play store is causing issues because something changed in a newer play store version (because that is the thing with xposed: new versions of apps that get modified can break the functionality easily)

-> the thing is: that it crashed after the finished install shows: something play store related is causing issues

I guess it could be some kinda service in the play store app that crashed with it so that some variable was null that shouldn't be null

->we only know if you test it on a clean install

crankycoder commented 9 years ago

Hrm. Maybe this isn't XPosed. It's some other bug. The mWifiScanner and mCellScanner attributes are null, but I don't see how this is even possible.

E/AndroidRuntime(13486): FATAL EXCEPTION: main
E/AndroidRuntime(13486): Process: com.crankycoder.demostumbler, PID: 13486
E/AndroidRuntime(13486): java.lang.NullPointerException
E/AndroidRuntime(13486): >--at org.mozilla.mozstumbler.service.stumblerthread.scanners.ScanManager.newPassiveGpsLocation(ScanManager.java:120)
E/AndroidRuntime(13486): >--at org.mozilla.mozstumbler.service.stumblerthread.scanners.GPSScanner.onLocationChanged(GPSScanner.java:205)
E/AndroidRuntime(13486): >--at android.location.LocationManager$ListenerTransport._handleMessage(LocationManager.java:279)
E/AndroidRuntime(13486): >--at android.location.LocationManager$ListenerTransport.access$000(LocationManager.java:208)
E/AndroidRuntime(13486): >--at android.location.LocationManager$ListenerTransport$1.handleMessage(LocationManager.java:224)
E/AndroidRuntime(13486): >--at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(13486): >--at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime(13486): >--at android.app.ActivityThread.main(ActivityThread.java:5146)
E/AndroidRuntime(13486): >--at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(13486): >--at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(13486): >--at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
E/AndroidRuntime(13486): >--at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
E/AndroidRuntime(13486): >--at dalvik.system.NativeStart.main(Native Method)
D/LogFetchServiceManager( 7406): Received entry added
crankycoder commented 9 years ago

Ah. This is a bad side effect of the simulation code I landed a while back. This only affects the libstumbler version of the stumbler because it's excercising passive stumbling - a code path we don't actively use in the standalone version of Mozilla Stumbler.

This also doesn't show up in Fennec because the code over there doesn't contain some of the newer changes (like simulation mode) that we have in this codebase.

tl;dr - I'll refactor the simulation code to be cleaner. This bug has nothing to do with xposed.

crankycoder commented 9 years ago

I'm not certain there is a problem with xposed, but I am aware of some incompatibility issues listed over here:

http://forum.xda-developers.com/xposed/framework-xposed-rom-modding-modifying-t1574401/post42048445#post42048445

I'd like to be able to just alert the user that Xposed is installed and may cause crashing issues.

Djfe commented 9 years ago

I don't get why you linked to that particular post I mean it's not about any app related issues the only thing discussed is that the boot got slowed down (by system UI related anrs/crashes)

crankycoder commented 9 years ago

Sorry - wrong link. There are known issues with SELinux which is baked into at least CM11.

http://forum.xda-developers.com/xposed/xposed-faq-issues-t2735540

Djfe commented 9 years ago

the SELinux issues are about HTC devices, so maybe CM itself isn't an issue.

And SELinux is part of the newest android versions and it makes sense for CM to implement them from the AOSP source code, since all devices should/will have it enabled that use newer android versions

I'm using CM11 (Kitkat) in SELinux strict mode and I don't experience any issues at all on my Sony Xperia Arc S.

Since rovo doesn't own all devices he needs testers for them to be able to debug certain issues. (This one seems to be HTC Sense dependend (ROM))

Right now though his focus is on Lollipop (higher priority) so I guess the HTC issue will remain for some time.