After installing the latest version of the Tor Browser for Android, the app now crashes shortly after launching it. 11.0.6 is still working without issue.
Browser version: 11.0.8
Install method: The Guardian Project's Official F-Droid Repository
It's crashing in LineageOS (17.1) as well. Had to downgrade to Tor Browser 11.0.6. And it crashed in another device with LineageOS 15.1 upon updating, but it stopped crashing and seems to work fine now, though it seems somewhat slower than 11.0.6
i can reproduce locally (tb 11.0.8 on pixel 4 emulator running android 10), but only in roughly 1 in 10 trials.
in some (maybe?) happy news: whenever i observe the crash, i can always re-launch tor-browser without issue on the next try. in other words -- it appears to be a bug that only happens on the first time trying to launch after an install or upgrade.
as for fixes, the error is a currently somewhat inscrutable segfault coming from glean/libxul:
i cannot get a human-readable backtrace b/c: we exclude the .aar with debug symbols from the build.
assuming we can inject them from the debug artifact@pierov was able to build , it will be challenging to set a debug point (as per android dev docs b/c of the 3-layer architecture of fenix, which is split between the fenix layer (which runs the app), the android-components layer, and the geckoview layer (which contains the native code we wish to debug).
currently working off of this guide from mozilla but thus far i am not getting any traction b/c i cannot use the mach build tool locally outside of tor-browser-build. (for somewhat weedy technical reasons i'll detail in a comment below.)
this raises a more important point: i have never observed the crash when running from source. i only see it when installing an already-build apk and running it the first time. (and then, i only observe the crash in ~1 in 8-10 trials)
update: after 30 trials, i cannot reproduce the crash when attempting to run fenix from source in android studio in debug mode.[*]
conclusion: either the bug cannot be reproduced this way, or i do not have the patience to do so.
upshot: the bug appears to only be possible to observe the bug in an apk outputted by tor-browser-build, which means it will only be possible to observe a debugger at a breakpoint for the segfault by attaching a debugger to the running apk in the fraction of a second between when it starts and when it crashes.
super-hackily injecting the .aar artifact for geckoview into my local gradle cache (to make up for the fact i cannot build it with mach) with a variation on this script:
inject_geckoview(){if["$#"= 0 ];thenecho"USAGE: inject_geckoview <gv_versionX.Y>"return 0fiversion=$1gv_src=$(find .-name"*${version}*.aar")gv_dst=$(find ~/.gradle/caches -name"geckoview-omni-${version}*.aar")echo"Copying ${gv_src}\nto $gv_dst\nPress any key to continue..."read continuecp$gv_src$gv_dstecho"done."}
update: got a slightly more verbose (but not more helpful) error report out of glean just now. indicates a null-pointer dereference (but still no debug symbols):
I can get it to crash extremely reliably on LineageOS ( android 11). It crashes more then it works. It feels like it is crashing more often then it first did. For example, it feels like the longer the app has been on the phone and used, the more often it crashes. I have gotten into some ridiculous crash chains.
Version: 11.0.8
Fdroid version
I did notice something strange after some of the crashes. If instead of relaunching the app, I instead look at currently running apps on the phone, I find the Tor Browser opened up. I can swap to that mysteriously opened Tor Browser and use it. It is almost like the process that got opened is causing future launches to crash.
i cannot currently run mach (mozilla's build tool) on my local machine outside of the containerized setup used by tor-browser-build. here is what i try to run (the env vars are workarounds for previously-observed halting errors):
0:06.12 > Task :geckoview:preBuild UP-TO-DATE 0:06.12 > Task :geckoview:preWithGeckoBinariesDebugBuild UP-TO-DATE 0:06.12 > Task :annotations:compileJava FAILED 0:06.12 > Task :geckoview:compileWithGeckoBinariesDebugAidl FAILED 0:06.12 FAILURE: Build completed with 2 failures. 0:06.12 1: Task failed with an exception. 0:06.12 ----------- 0:06.12 * What went wrong: 0:06.12 Execution failed for task ':annotations:compileJava'. 0:06.12 > Could not resolve all files for configuration ':annotations:compileClasspath'. 0:06.12 > Could not resolve com.android.tools.lint:lint:26.2.1. 0:06.12 Required by: 0:06.12 project :annotations 0:06.12 > Could not resolve com.android.tools.lint:lint:26.2.1. 0:06.12 > Could not get resource 'https://maven.mozilla.org/maven2/com/android/tools/lint/lint/26.2.1/lint-26.2.1.pom'. 0:06.12 > java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext) 0:06.12 > Could not resolve com.android.tools.lint:lint:26.2.1. 0:06.12 > Could not get resource 'https://maven.google.com/com/android/tools/lint/lint/26.2.1/lint-26.2.1.pom'. 0:06.12 > java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext) 0:06.12 > Could not resolve com.android.tools.lint:lint:26.2.1. 0:06.13 > Could not get resource 'https://repo.maven.apache.org/maven2/com/android/tools/lint/lint/26.2.1/lint-26.2.1.pom'. 0:06.13 > java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext) 0:06.13 > Could not resolve com.android.tools.lint:lint:26.2.1. 0:06.13 > Could not get resource 'https://plugins.gradle.org/m2/com/android/tools/lint/lint/26.2.1/lint-26.2.1.pom'. 0:06.13 > java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext) [snip] 0:06.13 ============================================================================== 0:06.13 2: Task failed with an exception. 0:06.13 ----------- 0:06.13 * What went wrong: 0:06.13 Execution failed for task ':geckoview:compileWithGeckoBinariesDebugAidl'. 0:06.13 > Could not resolve all files for configuration ':geckoview:withGeckoBinariesDebugCompileClasspath'. 0:06.13 > Could not resolve org.checkerframework:checker-compat-qual:2.5.0. 0:06.13 Required by: 0:06.13 project :geckoview 0:06.13 > Could not resolve org.checkerframework:checker-compat-qual:2.5.0. 0:06.13 > Could not get resource 'https://maven.mozilla.org/maven2/org/checkerframework/checker-compat-qual/2.5.0/checker-compat-qual-2.5.0.pom'. 0:06.13 > java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext) [snip] 0:06.22 ============================================================================== 0:06.22 * Get more help at https://help.gradle.org 0:06.22 Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. 0:06.22 You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. 0:06.22 See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings 0:06.22 BUILD FAILED in 2s 0:06.22 2 actionable tasks: 2 executed 0:06.34 Traceback (most recent call last): 0:06.34 File "/home/aguestuser/.pyenv/versions/3.8.12/lib/python3.8/runpy.py", line 194, in _run_module_as_main 0:06.34 return _run_code(code, main_globals, None, 0:06.34 File "/home/aguestuser/.pyenv/versions/3.8.12/lib/python3.8/runpy.py", line 87, in _run_code 0:06.34 exec(code, run_globals) 0:06.34 File "/home/aguestuser/-/tor/code/tor-browser/python/mozbuild/mozbuild/action/file_generate.py", line 156, in <module> 0:06.34 sys.exit(log_build_task(main, sys.argv[1:])) 0:06.34 File "/home/aguestuser/-/tor/code/tor-browser/python/mozbuild/mozbuild/action/util.py", line 18, in log_build_task 0:06.34 return f(*args, **kwargs) 0:06.34 File "/home/aguestuser/-/tor/code/tor-browser/python/mozbuild/mozbuild/action/file_generate.py", line 100, in main 0:06.34 ret = module.__dict__[method]( 0:06.34 File "/home/aguestuser/-/tor/code/tor-browser/mobile/android/gradle.py", line 57, in assemble_app 0:06.34 return android("assemble-app") 0:06.34 File "/home/aguestuser/-/tor/code/tor-browser/mobile/android/gradle.py", line 51, in android 0:06.34 subprocess.check_call(cmd, env=env) 0:06.34 File "/home/aguestuser/.pyenv/versions/3.8.12/lib/python3.8/subprocess.py", line 364, in check_call 0:06.34 raise CalledProcessError(retcode, cmd) 0:06.34 subprocess.CalledProcessError: Command '['/home/aguestuser/-/tor/code/tor-browser/obj-i386-linux-android/_virtualenvs/build/bin/python', '/home/aguestuser/-/tor/code/tor-browser/mach', 'android', 'assemble-app']' returned non-zero exit status 1. 0:06.36 gmake[3]: *** [backend.mk:797: mobile/android/.deps/android_apks.stub] Error 1 0:06.36 gmake[3]: *** Waiting for unfinished jobs.... 0:06.40 gmake[4]: Leaving directory '/home/aguestuser/-/tor/code/tor-browser/obj-i386-linux-android/dom/bindings' 0:07.79 0:00.42 /snap/bin/gradle geckoview:generateJNIWrappersForGeneratedWithGeckoBinariesDebug 0:07.83 Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=utf-8 0:08.37 settings.gradle> Read local.properties: /home/aguestuser/-/tor/code/tor-browser/local.properties 0:10.18 > Task :geckoview:preBuild UP-TO-DATE 0:10.18 > Task :geckoview:preWithGeckoBinariesDebugBuild UP-TO-DATE 0:10.18 > Task :annotations:compileJava FAILED 0:10.18 > Task :geckoview:compileWithGeckoBinariesDebugAidl FAILED 0:10.24 FAILURE: Build completed with 2 failures. 0:10.24 1: Task failed with an exception. 0:10.24 ----------- 0:10.24 * What went wrong: 0:10.24 Execution failed for task ':annotations:compileJava'. 0:10.24 > Could not resolve all files for configuration ':annotations:compileClasspath'. 0:10.24 > Could not resolve com.android.tools.lint:lint:26.2.1. 0:10.24 Required by: 0:10.24 project :annotations 0:10.24 > Could not resolve com.android.tools.lint:lint:26.2.1. 0:10.24 > Could not get resource 'https://maven.mozilla.org/maven2/com/android/tools/lint/lint/26.2.1/lint-26.2.1.pom'. 0:10.24 > java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext) [snip] 0:10.25 ============================================================================== 0:10.25 2: Task failed with an exception. 0:10.25 ----------- 0:10.25 * What went wrong: 0:10.25 Execution failed for task ':geckoview:compileWithGeckoBinariesDebugAidl'. 0:10.25 > Could not resolve all files for configuration ':geckoview:withGeckoBinariesDebugCompileClasspath'. 0:10.25 > Could not resolve org.checkerframework:checker-compat-qual:2.5.0. 0:10.25 Required by: 0:10.25 project :geckoview 0:10.25 > Could not resolve org.checkerframework:checker-compat-qual:2.5.0. 0:10.25 > Could not get resource 'https://maven.mozilla.org/maven2/org/checkerframework/checker-compat-qual/2.5.0/checker-compat-qual-2.5.0.pom'. 0:10.25 > java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext) [snip] 0:10.27 ============================================================================== 0:10.27 * Get more help at https://help.gradle.org 0:10.27 Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. 0:10.27 You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. 0:10.27 See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings 0:10.27 BUILD FAILED in 2s 0:10.27 2 actionable tasks: 2 executed 0:10.36 Traceback (most recent call last): 0:10.36 File "/home/aguestuser/.pyenv/versions/3.8.12/lib/python3.8/runpy.py", line 194, in _run_module_as_main 0:10.36 return _run_code(code, main_globals, None, 0:10.36 File "/home/aguestuser/.pyenv/versions/3.8.12/lib/python3.8/runpy.py", line 87, in _run_code 0:10.36 exec(code, run_globals) 0:10.36 File "/home/aguestuser/-/tor/code/tor-browser/python/mozbuild/mozbuild/action/file_generate.py", line 156, in <module> 0:10.36 sys.exit(log_build_task(main, sys.argv[1:])) 0:10.36 File "/home/aguestuser/-/tor/code/tor-browser/python/mozbuild/mozbuild/action/util.py", line 18, in log_build_task 0:10.36 return f(*args, **kwargs) 0:10.36 File "/home/aguestuser/-/tor/code/tor-browser/python/mozbuild/mozbuild/action/file_generate.py", line 100, in main 0:10.36 ret = module.__dict__[method]( 0:10.36 File "/home/aguestuser/-/tor/code/tor-browser/mobile/android/gradle.py", line 65, in generate_generated_jni_wrappers 0:10.36 return android("generate-generated-jni-wrappers", *args) 0:10.36 File "/home/aguestuser/-/tor/code/tor-browser/mobile/android/gradle.py", line 51, in android 0:10.36 subprocess.check_call(cmd, env=env) 0:10.36 File "/home/aguestuser/.pyenv/versions/3.8.12/lib/python3.8/subprocess.py", line 364, in check_call 0:10.36 raise CalledProcessError(retcode, cmd) 0:10.36 subprocess.CalledProcessError: Command '['/home/aguestuser/-/tor/code/tor-browser/obj-i386-linux-android/_virtualenvs/build/bin/python', '/home/aguestuser/-/tor/code/tor-browser/mach', 'android', 'generate-generated-jni-wrappers']' returned non-zero exit status 1. 0:10.37 gmake[4]: *** [backend.mk:191: .deps/generated_jni_wrappers.stub] Error 1 0:10.37 gmake[4]: Leaving directory '/home/aguestuser/-/tor/code/tor-browser/obj-i386-linux-android/widget/android' 0:10.37 gmake[3]: *** [/home/aguestuser/-/tor/code/tor-browser/config/recurse.mk:99: widget/android/export] Error 2 0:10.37 gmake[3]: Leaving directory '/home/aguestuser/-/tor/code/tor-browser/obj-i386-linux-android' 0:10.37 gmake[2]: *** [/home/aguestuser/-/tor/code/tor-browser/config/recurse.mk:34: export] Error 2 0:10.37 gmake[2]: Leaving directory '/home/aguestuser/-/tor/code/tor-browser/obj-i386-linux-android' 0:10.37 gmake[1]: *** [/home/aguestuser/-/tor/code/tor-browser/config/rules.mk:352: default] Error 2 0:10.37 gmake[1]: Leaving directory '/home/aguestuser/-/tor/code/tor-browser/obj-i386-linux-android' 0:10.37 gmake: *** [client.mk:63: build] Error 2 0:10.37 10 compiler warnings present.
welp. i am surprised you are able to build with 4.4.1! i get:
0:51.45 FAILURE: Build failed with an exception. 0:51.45 * Where: 0:51.45 Build file '/home/aguestuser/-/tor/code/tor-browser/build.gradle' line: 274 0:51.45 * What went wrong: 0:51.46 A problem occurred evaluating root project 'tor-browser'. 0:51.46 > Failed to apply plugin [id 'com.diffplug.spotless'] 0:51.46 > Spotless requires Gradle 6.1 or newer, this was 4.4.1
gradle --versionWARNING: An illegal reflective access operation has occurredWARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/usr/share/java/groovy-all.jar) to method java.lang.Object.finalize()WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClassWARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operationsWARNING: All illegal access operations will be denied in a future release------------------------------------------------------------Gradle 4.4.1------------------------------------------------------------Build time: 2012-12-21 00:00:00 UTCRevision: noneGroovy: 2.4.21Ant: Apache Ant(TM) version 1.10.12 compiled on January 17 1970JVM: 11.0.14 (Debian 11.0.14+9-post-Debian-1)OS: Linux 5.16.0-3-amd64 amd64
@pierov okay, potential breakthrough? tried running from source (with injected geckoview) on an actual device in android-studio's debug mode. triggered the segfault, got a fatal error in the debug process (b/c it can't run glean):
I/System.out: waiting for debugger to settle...I/System.out: debugger has settled (1476)W/FirebaseApp: Default FirebaseApp failed to initialize because no default options were found. This usually means that com.google.gms:google-services was not applied to your gradle project.I/FirebaseInitProvider: FirebaseApp initialization unsuccessfulW/orbrowser_debu: Accessing hidden field Landroid/os/Trace;->TRACE_TAG_APP:J (light greylist, reflection)W/orbrowser_debu: Accessing hidden method Landroid/os/Trace;->isTagEnabled(J)Z (light greylist, reflection)D/glean/loadIndirect: Failed to load glean_ffiD/glean/loadIndirect: Trying to load libxul directlyW/glean/loadIndirect: Failed to load libxul. Can't use Glean.D/AndroidRuntime: Shutting down VME/AndroidRuntime: FATAL EXCEPTION: main Process: org.torproject.torbrowser_debug, PID: 7294 java.lang.ExceptionInInitializerError at mozilla.telemetry.glean.rust.LibGleanFFI.<clinit>(Unknown Source:0) at mozilla.telemetry.glean.private.CounterMetricType.<init>(CounterMetricType.kt:42) at org.mozilla.fenix.GleanMetrics.PerfStartup.<clinit>(PerfStartup.kt:129) at org.mozilla.fenix.FenixApplication.onCreate(FenixApplication.kt:108) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5925) at android.app.ActivityThread.access$1200(ActivityThread.java:212) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1690) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6725) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) Caused by: java.lang.IllegalStateException: Glean functionality not available at mozilla.telemetry.glean.rust.LibGleanFFIKt.loadIndirect$lambda-0(LibGleanFFI.kt:91) at mozilla.telemetry.glean.rust.LibGleanFFIKt.$r8$lambda$AyPKsZPqEjCDmY2zsCDil_ZXMHM(Unknown Source:0) at mozilla.telemetry.glean.rust.LibGleanFFIKt$$ExternalSyntheticLambda0.invoke(Unknown Source:2) at java.lang.reflect.Proxy.invoke(Proxy.java:1006) at $Proxy1.glean_enable_logging(Unknown Source) at mozilla.telemetry.glean.rust.LibGleanFFIKt.loadIndirect(LibGleanFFI.kt:96) at mozilla.telemetry.glean.rust.LibGleanFFI$Companion.<clinit>(LibGleanFFI.kt:105) at mozilla.telemetry.glean.rust.LibGleanFFI.<clinit>(Unknown Source:0) at mozilla.telemetry.glean.private.CounterMetricType.<init>(CounterMetricType.kt:42) at org.mozilla.fenix.GleanMetrics.PerfStartup.<clinit>(PerfStartup.kt:129) at org.mozilla.fenix.FenixApplication.onCreate(FenixApplication.kt:108) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5925) at android.app.ActivityThread.access$1200(ActivityThread.java:212) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1690) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6725) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) Caused by: java.lang.UnsatisfiedLinkError: Unable to load library 'xul': dlopen failed: library "libxul.so" not found dlopen failed: library "libxul.so" not found dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.torproject.torbrowser_debug-VzQtcGwr87bFBXLhk2iAMg==/base.apk"],nativeLibraryDirectories=[/data/app/org.torproject.torbrowser_debug-VzQtcGwr87bFBXLhk2iAMg==/lib/arm, /data/app/org.torproject.torbrowser_debug-VzQtcGwr87bFBXLhk2iAMg==/base.apk!/lib/armeabi-v7a, /system/lib]]] couldn't find "libxul.so" Native library (android-arm/libxul.so) not found in resource path (.) at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:301) at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:461) at com.sun.jna.Library$Handler.<init>(Library.java:192) at com.sun.jna.Native.load(Native.java:596) at com.sun.jna.Native.load(Native.java:570) at mozilla.telemetry.glean.rust.LibGleanFFIKt.loadIndirect(LibGleanFFI.kt:84) ... 15 more Suppressed: java.lang.UnsatisfiedLinkError: dlopen failed: library "libxul.so" not found at com.sun.jna.Native.open(Native Method) at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:191) ... 20 more Suppressed: java.lang.UnsatisfiedLinkError: dlopen failed: library "libxul.so" not found at com.sun.jna.Native.open(Native Method) at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:204) ... 20 more Suppressed: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.torproject.torbrowser_debug-VzQtcGwr87bFBXLhk2iAMg==/base.apk"],nativeLibraryDirectories=[/data/app/org.torproject.torbrowser_debug-VzQtcGwr87bFBXLhk2iAMg==/lib/arm, /data/app/org.torproject.torbrowser_debug-VzQtcGwr87bFBXLhk2iAMg==/base.apk!/lib/armeabi-v7a, /system/lib]]] couldn't find "libxul.so" at java.lang.Runtime.loadLibrary0(Runtime.java:1012) at java.lang.System.loadLibrary(System.java:1669) at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:218) ... 20 more Suppressed: java.io.IOException: Native library (android-arm/libxul.so) not found in resource path (.) at com.sun.jna.Native.extractFromResourcePath(Native.java:1119) at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:275) ... 20 moreI/Process: Sending signal. PID: 7294 SIG: 9Disconnected from the target VM, address: 'localhost:38277', transport: 'socket'
potentially trying again (having injected the debug .aar) could help?
in any case, it's a different error message, so: progress?
My hope here is that glean produces some dump we can then pass to a debugger to find more details (not sure this is a viable option).
So, we have two possibilities:
we inject LD_LIBRARY_PATH: IIRC, by default, dlopen obeys it, if a filename is specified (rather than an absolute path)
I also noticed this line: java.io.IOException: Native library (android-arm/libxul.so) not found in resource path (.). Maybe we could change this resource path
(also, could you please enclose logs in collapsible sections?)
I/System.out: debugger has settled (1476)W/FirebaseApp: Default FirebaseApp failed to initialize because no default options were found. This usually means that com.google.gms:google-services was not applied to your gradle project.I/FirebaseInitProvider: FirebaseApp initialization unsuccessfulW/orbrowser_debu: Accessing hidden field Landroid/os/Trace;->TRACE_TAG_APP:J (light greylist, reflection)W/orbrowser_debu: Accessing hidden method Landroid/os/Trace;->isTagEnabled(J)Z (light greylist, reflection)D/glean/loadIndirect: Failed to load glean_ffiD/glean/loadIndirect: Trying to load libxul directlyW/glean/loadIndirect: Failed to load libxul. Can't use Glean.D/AndroidRuntime: Shutting down VME/AndroidRuntime: FATAL EXCEPTION: main Process: org.torproject.torbrowser_debug, PID: 7294 java.lang.ExceptionInInitializerError at mozilla.telemetry.glean.rust.LibGleanFFI.<clinit>(Unknown Source:0) at mozilla.telemetry.glean.private.CounterMetricType.<init>(CounterMetricType.kt:42) at org.mozilla.fenix.GleanMetrics.PerfStartup.<clinit>(PerfStartup.kt:129) at org.mozilla.fenix.FenixApplication.onCreate(FenixApplication.kt:108) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5925) at android.app.ActivityThread.access$1200(ActivityThread.java:212) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1690) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6725) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) Caused by: java.lang.IllegalStateException: Glean functionality not available at mozilla.telemetry.glean.rust.LibGleanFFIKt.loadIndirect$lambda-0(LibGleanFFI.kt:91) at mozilla.telemetry.glean.rust.LibGleanFFIKt.$r8$lambda$AyPKsZPqEjCDmY2zsCDil_ZXMHM(Unknown Source:0) at mozilla.telemetry.glean.rust.LibGleanFFIKt$$ExternalSyntheticLambda0.invoke(Unknown Source:2) at java.lang.reflect.Proxy.invoke(Proxy.java:1006) at $Proxy1.glean_enable_logging(Unknown Source) at mozilla.telemetry.glean.rust.LibGleanFFIKt.loadIndirect(LibGleanFFI.kt:96) at mozilla.telemetry.glean.rust.LibGleanFFI$Companion.<clinit>(LibGleanFFI.kt:105) at mozilla.telemetry.glean.rust.LibGleanFFI.<clinit>(Unknown Source:0) at mozilla.telemetry.glean.private.CounterMetricType.<init>(CounterMetricType.kt:42) at org.mozilla.fenix.GleanMetrics.PerfStartup.<clinit>(PerfStartup.kt:129) at org.mozilla.fenix.FenixApplication.onCreate(FenixApplication.kt:108) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5925) at android.app.ActivityThread.access$1200(ActivityThread.java:212) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1690) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6725) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) Caused by: java.lang.UnsatisfiedLinkError: Unable to load library 'xul': dlopen failed: library "libxul.so" not found dlopen failed: library "libxul.so" not found dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.torproject.torbrowser_debug-VzQtcGwr87bFBXLhk2iAMg==/base.apk"],nativeLibraryDirectories=[/data/app/org.torproject.torbrowser_debug-VzQtcGwr87bFBXLhk2iAMg==/lib/arm, /data/app/org.torproject.torbrowser_debug-VzQtcGwr87bFBXLhk2iAMg==/base.apk!/lib/armeabi-v7a, /system/lib]]] couldn't find "libxul.so" Native library (android-arm/libxul.so) not found in resource path (.) at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:301) at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:461) at com.sun.jna.Library$Handler.<init>(Library.java:192) at com.sun.jna.Native.load(Native.java:596) at com.sun.jna.Native.load(Native.java:570) at mozilla.telemetry.glean.rust.LibGleanFFIKt.loadIndirect(LibGleanFFI.kt:84) ... 15 more Suppressed: java.lang.UnsatisfiedLinkError: dlopen failed: library "libxul.so" not found at com.sun.jna.Native.open(Native Method) at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:191) ... 20 more Suppressed: java.lang.UnsatisfiedLinkError: dlopen failed: library "libxul.so" not found at com.sun.jna.Native.open(Native Method) at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:204) ... 20 more Suppressed: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.torproject.torbrowser_debug-VzQtcGwr87bFBXLhk2iAMg==/base.apk"],nativeLibraryDirectories=[/data/app/org.torproject.torbrowser_debug-VzQtcGwr87bFBXLhk2iAMg==/lib/arm, /data/app/org.torproject.torbrowser_debug-VzQtcGwr87bFBXLhk2iAMg==/base.apk!/lib/armeabi-v7a, /system/lib]]] couldn't find "libxul.so" at java.lang.Runtime.loadLibrary0(Runtime.java:1012) at java.lang.System.loadLibrary(System.java:1669) at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:218) ... 20 more Suppressed: java.io.IOException: Native library (android-arm/libxul.so) not found in resource path (.) at com.sun.jna.Native.extractFromResourcePath(Native.java:1119) at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:275) ... 20 moreI/Process: Sending signal. PID: 7294 SIG: 9Disconnected from the target VM, address: 'localhost:38277', transport: 'socket'
Okay, so switching to this: offset 0x142000 is mildly interesting.
Do you think you could reproduce this with the debug .aar?
If it is the offset inside libxul.so, with symbols we may understand what it corresponds to.
going to try injecting debug .aar and running on arm7 physical device. but last time that approach produced the "cannot use glean error" so -- reasons to doubt it will work but why not try! :)
latest update on attempts to run from source (so that we can get debug symbols) are not promising:
on every trial in which i inject the .aar i built w/ tor-browser-build (on 2022-03-10) and shipped with the 11.0.8 release .apk, it works -- both on an emulator (x86/android-10) and device (arm7/android-9)
java.lang.IllegalStateException: Glean functionality not availablejava.lang.UnsatisfiedLinkError: Unable to load library 'xul': dlopen failed: library "libxul.so" not found
on some trials running the release apk i get a crash, but do not see the runtime error about missing libxul, but rather see the glean debug output resulting from an unexplained segfault, eg: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR) (see above for full examples)
given all that, it seems the best shot is perhaps to try @pierov 's suggestion to inject LD_LIBRARY_PATH to force dlopen to try to find native libs there (instead of, e.g., /data/app/org.torproject.torbrowser_debug-h3kZSP_Lr6Jlm67j38cDDw==/lib/x86 as it currently tries to do) -- in the hopes that doing so might eliminate the runtime error, preserve the segfault, and allow us to inspect its backtrace?
however, i am not really sure how we might try to figure out what path to point it to...
Hey, I think I know why you had problems with my debug artifact: it was for x86_64, not x86.
Anyway, the trick of extracting the Clang compiled by tor-browser-build and prepending it to $PATH seems to have worked, and I am building an aarch64 release right now.
@pierov ah! helpful to know. i have an x86_64 emulator i can try that on. but again -- can't reproduce the crash running from source so might not be all that helpful (since i likely can't trigger the bug in anything but a release apk). but: not much else on the table, so i will try!
libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 9469 (glean.dispatche), pid 9405 (AndroidUI)
I believe (2) is the most common crash according to Google Play (@aguestuser please confirm that is true). Getting geckoview debug symbols and attaching the debugger would be helpful. For the latter, stackoverflow may have a solution (add Debug.waitForDebugger() in FenixApplication.kt before initializing gecko).
and the build is correctly looking to tor-browser.git to try to build geckoview. BUT it's erroring as follows:
A problem occurred evaluating script.> Process '[/home/aguestuser/bb/tor-browser/mach, environment, --format, json, --verbose]' finished with non-zero exit value 1: Error running mach: ['environment', '--format', 'json', '--verbose'] The error occurred in code that was called by the mach command. This is either a bug in the called code itself or in the way that mach is calling it. You can invoke |./mach busted| to check if this issue is already on file. If it isn't, please use |./mach busted file environment| to report it. If |./mach busted| is misbehaving, you can also inspect the dependencies of bug 1543241. If filing a bug, please include the full output of mach, including this error message. The details of the failure are as follows: mozbuild.base.BuildEnvironmentNotFoundException: config.status not available. Run configure. File "/home/aguestuser/bb/tor-browser/python/mozbuild/mozbuild/mach_commands.py", line 1876, in environment return func(command_context, sys.stdout, verbose) File "/home/aguestuser/bb/tor-browser/python/mozbuild/mozbuild/mach_commands.py", line 1950, in _environment_json json.dump(command_context, cls=EnvironmentEncoder, sort_keys=True, fp=out) File "/home/aguestuser/.pyenv/versions/3.8.12/lib/python3.8/json/__init__.py", line 179, in dump for chunk in iterable: File "/home/aguestuser/.pyenv/versions/3.8.12/lib/python3.8/json/encoder.py", line 438, in _iterencode o = _default(o) File "/home/aguestuser/bb/tor-browser/python/mozbuild/mozbuild/mach_commands.py", line 1943, in default result["substs"] = obj.substs File "/home/aguestuser/bb/tor-browser/python/mozbuild/mozbuild/base.py", line 415, in substs return self.config_environment.substs File "/home/aguestuser/bb/tor-browser/python/mozbuild/mozbuild/base.py", line 391, in config_environment raise BuildEnvironmentNotFoundException(
which i can reproduce in tor-browser.git as follows:
so -- clearly i have some sort of configuration. just not the right one? i suppose my questions are:
what is so special about the --verbose status that it makes it look for this config.status key it doesn't seem to be able to find
how is this correlated with the BuildEnvironment that is NotFound
how can i ensure that this is set? (if i have already run ./mach --configure <snip>?
did you hit this?
does this correlate at all with your trying to make sure to set MACH_USE_SYSTEM_PYTHON=1 -- and if not: what problem were you trying to solve with that?
I had this error as well, and then other stuff to do came, so I didn't solve any of this, I am sorry.
But MACH_USE_SYSTEM_PYTHON=1 is not related. I suppose that after the first configuration, this environment variable is not needed anymore (because mach does its stuff on the obj-... directory, which is related to the configuration because it needs to know the target architecture!).
Now that you mention this, you can create a local.properties in the geckoview directory, I created mine like this: