Tor.framework icon indicating copy to clipboard operation
Tor.framework copied to clipboard

v0.4.8.19 Crashes when start/stop more then once.

Open Fonta1n3 opened this issue 2 months ago • 9 comments

When my app goes into the background I force Tor to quit and when it reenters the foreground it reboots. Previously this worked fine without any crashes.

Now I notice that if Tor.framework v0.4.8.19 is forced to quit and reboot more than once it crashes my app with an ugly error:

Image

Fonta1n3 avatar Nov 15 '25 05:11 Fonta1n3

Maybe it's this problem?

https://github.com/guardianproject/orbot-android/issues/1479#issuecomment-3534212622

I released 0.4.8.20 yesterday. Is it still a problem?

tladesignz avatar Nov 18 '25 09:11 tladesignz

Thank you, will test and revert back soon.

Fonta1n3 avatar Nov 19 '25 06:11 Fonta1n3

Can confirm the issue remains, same error message, same crash.

Fonta1n3 avatar Nov 19 '25 10:11 Fonta1n3

Just released a 0.4.8.21 build. Still the same?

tladesignz avatar Nov 25 '25 11:11 tladesignz

Just tried and yes I am still getting a crash:

warning: Tor was compiled with optimization - stepping may behave oddly; variables may not be available.Can't show file for stack frame : <DBGLLDBStackFrame: 0x3518b0e70> - stackNumber:0 - name:worker_thread_main [inlined]. The file path does not exist on the file system: /var/folders/mr/lw68m7t562z9sccvfy8qrdwc0000gn/T/tmp.4cWhf2K5l2/tor/src/lib/evloop/workqueue.c

Fonta1n3 avatar Nov 25 '25 14:11 Fonta1n3

warning: Tor was compiled with optimization - stepping may behave oddly; variables may not be available.Can't show file for 
stack frame : <DBGLLDBStackFrame: 0x3518b0e70> - stackNumber:0 - name:worker_thread_main [inlined]. The file path 
does not exist on the file system: 
/var/folders/mr/lw68m7t562z9sccvfy8qrdwc0000gn/T/tmp.4cWhf2K5l2/tor/src/lib/evloop/workqueue.c

That's just a message from the debugger, meaning, the debugger is sorry for not being able to show you code instead of memory addresses and opcodes. (Because you use production builds, which don't have debugging information attached.)

Anyway, these are the referenced code pieces from your screenshot:

  • https://gitlab.torproject.org/tpo/core/tor/-/blob/tor-0.4.8.19/src/lib/lock/compat_mutex_pthreads.c?ref_type=tags#L72
  • https://gitlab.torproject.org/tpo/core/tor/-/blob/tor-0.4.8.19/src/lib/log/log.h?ref_type=tags#L219
  • Crash is in between here, AFAIU
  • https://gitlab.torproject.org/tpo/core/tor/-/blob/tor-0.4.8.19/src/lib/evloop/workqueue.c?ref_type=tags#L235
  • https://gitlab.torproject.org/tpo/core/tor/-/blob/tor-0.4.8.19/src/lib/evloop/workqueue.c?ref_type=tags#L322
  • https://gitlab.torproject.org/tpo/core/tor/-/blob/tor-0.4.8.19/src/lib/crypt_ops/crypto_rand_fast.c?ref_type=tags#L378

tladesignz avatar Nov 25 '25 16:11 tladesignz

If there is anything more i can provide to help debug please let me know.

I'll just downgrade for now.

Fonta1n3 avatar Nov 25 '25 16:11 Fonta1n3

So, just to be clear: .18 was fine?

Would it be possible for you to git bisect this?

You would need to check out Tor.framework and reference the local checkout from your project.

git clone [email protected]:iCepa/Tor.framework.git
cd Tor.framework

mkdir build
cd build

git clone --recursive  https://gitlab.torproject.org/tpo/core/tor.git

cd tor
git bisect start
git bisect good 801ef23181a1c09c06701f49003b35825b9e9a5c # tor-0.4.8.18
git bisect bad ffe63d09dc162ca109f7612ad782cb950598aed5 # tor-0.4.8.19

cd ../..
./build-xcframwork.sh -d

Here's a patch for build-xcframework.sh, so you only build the minimum (no LZMA, only iOS arm64 real device binaries):

diff --git a/build-xcframework.sh b/build-xcframework.sh
index af40f41..6e07091 100755
--- a/build-xcframework.sh
+++ b/build-xcframework.sh
@@ -378,70 +378,24 @@ create_framework() {
     cp -r "${HEADERS[@]}" "$BUILDDIR/$SDK/$NAME.framework/Headers" >> "$LOG" 2>&1
 }
 
-build_liblzma       iphoneos            arm64           15.0
 build_libssl        iphoneos            arm64           15.0
 build_libevent      iphoneos            arm64           15.0
-build_libtor        iphoneos            arm64           15.0
 build_libtor        iphoneos            arm64           15.0    nolzma
-create_framework    iphoneos
 create_framework    iphoneos            ""              nolzma
 
-build_liblzma       iphonesimulator     arm64           15.0
-build_liblzma       iphonesimulator     x86_64          15.0
-fatten              liblzma             iphonesimulator
-build_libssl        iphonesimulator     arm64           15.0
-build_libssl        iphonesimulator     x86_64          15.0
-fatten              libssl              iphonesimulator
-fatten              libssl              iphonesimulator libcrypto
-build_libevent      iphonesimulator     arm64           15.0
-build_libevent      iphonesimulator     x86_64          15.0
-fatten              libevent            iphonesimulator
-build_libtor        iphonesimulator     arm64           15.0
-build_libtor        iphonesimulator     x86_64          15.0
-fatten              libtor              iphonesimulator
-build_libtor        iphonesimulator     arm64           15.0    nolzma
-build_libtor        iphonesimulator     x86_64          15.0    nolzma
-fatten              libtor-nolzma       iphonesimulator libtor
-create_framework    iphonesimulator     fat
-create_framework    iphonesimulator     fat             nolzma
-
-build_liblzma       macosx              arm64           11.0
-build_liblzma       macosx              x86_64          11.0
-fatten              liblzma             macosx
-build_libssl        macosx              arm64           11.0
-build_libssl        macosx              x86_64          11.0
-fatten              libssl              macosx
-fatten              libssl              macosx          libcrypto
-build_libevent      macosx              arm64           11.0
-build_libevent      macosx              x86_64          11.0
-fatten              libevent            macosx
-build_libtor        macosx              arm64           11.0
-build_libtor        macosx              x86_64          11.0
-fatten              libtor              macosx
-build_libtor        macosx              arm64           11.0    nolzma
-build_libtor        macosx              x86_64          11.0    nolzma
-fatten              libtor-nolzma       macosx          libtor
-create_framework    macosx              fat
-create_framework    macosx              fat             nolzma
-
 echo "- Create xcframework"
 
 LOG="$BUILDDIR/framework.log"
 
-for name in "tor" "tor-nolzma"
+for name in "tor-nolzma"
 do
     rm -rf "$ROOT/$name.xcframework" "$ROOT/$name.xcframework.zip" >> "$LOG" 2>&1
 
     xcodebuild -create-xcframework \
         -framework "$BUILDDIR/iphoneos/$name.framework" \
-        -framework "$BUILDDIR/iphonesimulator/$name.framework" \
-        -framework "$BUILDDIR/macosx/$name.framework" \
         -output "$ROOT/$name.xcframework" >> "$LOG" 2>&1
 
     cd "$ROOT"
-
-    zip -r -9 "$name.xcframework.zip" "$name.xcframework" >> "$LOG" 2>&1
-    shasum -a 256 "$name.xcframework.zip"
 done
 
 if [ -z $DEBUG ]; then

tladesignz avatar Nov 25 '25 17:11 tladesignz

So, just to be clear: .18 was fine?

Good question, let me test more and make sure that is the case.

Fonta1n3 avatar Nov 26 '25 03:11 Fonta1n3