"hs_circuitmap_init: Assertion !the_hs_circuitmap failed" when repeating failed tests on Android
When repeated running the Android `TorService` test suite from https://gitlab.com/eighthave/tor-android, I occasionally received this crash: ``` main src/feature/hs/hs_circuitmap.c:598: hs_circuitmap_init: Assertion !the_hs_circuitmap failed; aborting. TorService Bug: Tor 0.4.2.5 (git-7e55ab23311d00b6): Assertion !the_hs_circuitmap failed in hs_circuitmap_init at src/feature/hs/hs_circuitmap.c:598: . (Stack trace not available) (on Tor 0.4.2.5 7e55ab23311d00b6) libc Fatal signal 6 (SIGABRT), code -6 in tid 862 (tor), pid 836 (oid.binary.test) TorService ⇠ run [1425ms] DEBUG #00 pc 00000af0 [vdso:f319a000] (__kernel_vsyscall+16) #01 pc 0001edf8 /system/lib/libc.so (syscall+40) #02 pc 0001f073 /system/lib/libc.so (abort+115) #03 pc 0025ab6e /data/app/org.torproject.android.binary.test-FWLW5957oXEttHq4Pbyz4w==/lib/x86/libtor.so (tor_raw_abort_+31) #04 pc 0025673e /data/app/org.torproject.android.binary.test-FWLW5957oXEttHq4Pbyz4w==/lib/x86/libtor.so (tor_abort_+31) #05 pc 0014df1d /data/app/org.torproject.android.binary.test-FWLW5957oXEttHq4Pbyz4w==/lib/x86/libtor.so (hs_circuitmap_init+146) #06 pc 00154110 /data/app/org.torproject.android.binary.test-FWLW5957oXEttHq4Pbyz4w==/lib/x86/libtor.so (hs_init+39) #07 pc 000b17ac /data/app/org.torproject.android.binary.test-FWLW5957oXEttHq4Pbyz4w==/lib/x86/libtor.so (tor_init+132) #08 pc 000b2033 /data/app/org.torproject.android.binary.test-FWLW5957oXEttHq4Pbyz4w==/lib/x86/libtor.so (tor_run_main+243) #09 pc 000b0933 /data/app/org.torproject.android.binary.test-FWLW5957oXEttHq4Pbyz4w==/lib/x86/libtor.so (Java_org_torproject_jni_TorService_runMain+59) #10 pc 000085c8 /data/app/org.torproject.android.binary.test-FWLW5957oXEttHq4Pbyz4w==/oat/x86/base.odex (offset 0x8000) #11 pc 000091ff [anon:libc_malloc:e6980000] #12 pc 01114457 /dev/ashmem/dalvik-main space (region space) (deleted) #13 pc 80e30d65 <unknown> ``` * I think this only happened if Tor quit the test before due to bad command line args * it could be that the Android Test Orchestrator is reusing state that it shouldn't be https://developer.android.com/training/testing/junit-runner#using-android-test-orchestrator * "The Dalvik process hosting a typical app is forked off of zygote with all the common android libraries already mapped, so new unique copies don't have to be opened" https://stackoverflow.com/questions/9153166/understanding-android-zygote-and-dalvikvm nickm said: > So there are at least two possibilities: > 1) tor is busted and is calling hs_circuitmap_init() more than it should > 2) tor is busted and is calling hs_circuitmap_free_all() less than it should there are probably more, like: > 3) there is a problem in the android harness, and it is trying to restart tor before it has shut down
issue