Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on start after update to 1.48.3 #6221

Closed
flymarq opened this issue Nov 16, 2024 · 32 comments
Closed

Crash on start after update to 1.48.3 #6221

flymarq opened this issue Nov 16, 2024 · 32 comments
Labels
bug Something is not working

Comments

@flymarq
Copy link

flymarq commented Nov 16, 2024

I use DeltaChat for more than 5 years and got this error after updating to version 1.48.3 from FDroid:

  • Android version: 13 (GrapheneOS)
  • Device: Google Pixel 4 flame)
  • Delta Chat version: 1.48.3
  • Expected behavior: Normal startup
  • Actual behavior: App terminates after 1-2sec
  • Steps to reproduce the problem: start the application
  • Screenshots: none
  • Logs:
type: crash
osVersion: google/flame/flame:13/TP1A.221005.002.B2/2024092100:user/release-keys
package: com.b44t.messenger:7012
process: com.b44t.messenger
processUptime: 0 + 0 ms
installer: org.fdroid.fdroid

signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
Abort message: 'range end index 33 out of range for slice of length 4'

backtrace:
      #00 pc 000000000005b004  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164) (BuildId: 61deb31c5b39d5f735b66f2155a38a77)
      deltachat/deltachat-android#1 pc 0000000000cd1784  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#2 pc 0000000000cd1658  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#3 pc 0000000000e0d5a0  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#4 pc 0000000000e101c8  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#5 pc 0000000000e0feb4  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#6 pc 0000000000e0fe1c  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#7 pc 0000000000e0fe14  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#8 pc 00000000008a8050  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#9 pc 00000000008a8c4c  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#10 pc 000000000079b1a0  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#11 pc 00000000008d3cfc  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#12 pc 00000000009680b0  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#13 pc 0000000000967df8  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#14 pc 00000000009674b0  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#15 pc 0000000000983d14  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#16 pc 00000000009b4888  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#17 pc 00000000009a970c  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#18 pc 00000000009a8678  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#19 pc 000000000099ef1c  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#20 pc 00000000009893ec  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#21 pc 0000000000a6e14c  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#22 pc 0000000000a6ac14  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#23 pc 0000000000a6a87c  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#24 pc 0000000000a6a4c8  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#25 pc 0000000000e2084c  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#26 pc 0000000000e1f550  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#27 pc 0000000000a96960  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#28 pc 0000000000e1e884  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#29 pc 0000000000e1e5e4  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#30 pc 0000000000e238e4  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#31 pc 0000000000e1231c  /data/app/~~F_guk_i69IT_U81ZRvjrSg==/com.b44t.messenger-Wl85xf-nRuTROsbTUsZPGQ==/lib/arm64/libnative-utils.so (BuildId: c49bc05053535cecf363374ea3aeb01c201eb537)
      deltachat/deltachat-android#32 pc 00000000000c910c  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+204) (BuildId: 61deb31c5b39d5f735b66f2155a38a77)
      deltachat/deltachat-android#33 pc 000000000005c7b0  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 61deb31c5b39d5f735b66f2155a38a77)
@flymarq flymarq added the bug Something is not working label Nov 16, 2024
@link2xt
Copy link
Collaborator

link2xt commented Nov 16, 2024

Does it also crash if you are offline?

@flymarq
Copy link
Author

flymarq commented Nov 16, 2024

No!

Good idea, this way I can make backup and safe the current messages.

@link2xt
Copy link
Collaborator

link2xt commented Nov 16, 2024

Do you have multiple accounts? It is probably crashing while accessing one of the accounts over the network or trying to process one of the recently received messages. You can try to figure out which account it is and remove some of the recently received messages from the server.

@flymarq
Copy link
Author

flymarq commented Nov 16, 2024

No. I have only one account configured.

But keep in mind: the configuration is 5 years old.
If I changed the phone I used a deltachat backup to reinitialize deltachat on the new phone.

@link2xt
Copy link
Collaborator

link2xt commented Nov 16, 2024

I suspect you have recently received some message that makes the core crash, and this may not be related to 1.48.3 upgrade. So removing some recent messages from the server over IMAP or web interface could help, then Delta Chat will not download them anymore and stop crashing. Would be nice to figure out what exact message it is, but at least this should make Delta Chat usable again for you. If you move the last week of messages out of the server and start uploading them one by one with Thunderbird, you can find which message is the problem.

@flymarq
Copy link
Author

flymarq commented Nov 16, 2024

I run my own IMAP-server (dovecot):

  • I can see in the logs, that deltachat connects to the server before the crash
  • currently there are no unread messages (the folder new is empty)
  • removing one month of messages does not fix the crash

@link2xt
Copy link
Collaborator

link2xt commented Nov 16, 2024

If you can export a backup, can you also import it into another version, like older F-Droid or the latest nightly (https://download.delta.chat/android/nightly/2024-11-16/) and see if it crashes?

@link2xt
Copy link
Collaborator

link2xt commented Nov 16, 2024

Maybe the crash is related to the recently introduced IMAP COMPRESS support.

You can try to set minimal capabilities (excluding COMPRESS=DEFLATE) in Dovecot config, restart Dovecot and see if Delta Chat stops crashing:

imap_capability = IMAP4rev1 IDLE MOVE QUOTA CONDSTORE

@flymarq
Copy link
Author

flymarq commented Nov 17, 2024

Minimal capabilities with imap_capability = IMAP4rev1 IDLE MOVE QUOTA CONDSTORE still crashes.

@flymarq
Copy link
Author

flymarq commented Nov 17, 2024

Updating to https://download.delta.chat/android/nightly/2024-11-17/841c1d7f-foss-debug-1.48.3.apk DeltaChat still crashes.

Downgrading to FDroid Versions 1.46.14 or 1.46.13 also crashes with the same stack trace.

@flymarq
Copy link
Author

flymarq commented Nov 17, 2024

Deinstalling the app, reinstalling it and load the backup crashes too.

Tested with FDroid Version 1.48.3 and nichtly version 2024-11-17.

Are any values in the sqlite database in the backup of your interest?

@link2xt
Copy link
Collaborator

link2xt commented Nov 17, 2024

I can try to build an .apk with debug symbols that produces proper stack traces with function names. Then you can load the backup there and capture the stack trace like in the first post but with actual function names instead of the addresses.

@link2xt
Copy link
Collaborator

link2xt commented Nov 17, 2024

If you can build the core with Rust locally, a simpler way would be to download the source from https://github.com/deltachat/deltachat-core-rust/ and run cargo run --locked -p deltachat-repl -- deltachat.db, then import a backup using the import-backup command and run connect.

I am still trying to build .apk with non-stripped symbols.

@link2xt
Copy link
Collaborator

link2xt commented Nov 17, 2024

I managed to build unstripped .apk with these modifications:

diff --git a/build.gradle b/build.gradle
index 75e462c9a..5fee92da3 100644
--- a/build.gradle
+++ b/build.gradle
@@ -59,8 +59,9 @@ android {
         targetCompatibility JavaVersion.VERSION_1_8
     }
     packagingOptions {
+        doNotStrip "**/*.so"
         jniLibs {
-            keepDebugSymbols += ['*/mips/*.so', '*/mips64/*.so']
+            keepDebugSymbols += ['**/*.so']
         }
         resources {
             excludes += ['LICENSE.txt', 'LICENSE', 'NOTICE', 'asm-license.txt', 'META-INF/LICENSE', 'META-INF/NOTICE']
diff --git a/jni/Application.mk b/jni/Application.mk
index c6d1bbbd4..70170b12b 100644
--- a/jni/Application.mk
+++ b/jni/Application.mk
@@ -5,4 +5,5 @@ APP_STL := none
 ifneq ($(NDK_DEBUG),1)
 APP_CFLAGS  += -Oz -flto=full -fno-unwind-tables -fno-exceptions -fno-asynchronous-unwind-tables -fomit-frame-pointer
 APP_LDFLAGS += -flto=full
+APP_STRIP_MODE := none
 endif
diff --git a/jni/deltachat-core-rust b/jni/deltachat-core-rust
--- a/jni/deltachat-core-rust
+++ b/jni/deltachat-core-rust
@@ -1 +1 @@
-Subproject commit 88278fc826c7611f6d3fb30c57e4c8f4e95b8d05
+Subproject commit 88278fc826c7611f6d3fb30c57e4c8f4e95b8d05-dirty
diff --git a/scripts/ndk-make.sh b/scripts/ndk-make.sh
index 90bf70ac2..340ecd463 100755
--- a/scripts/ndk-make.sh
+++ b/scripts/ndk-make.sh
@@ -41,7 +41,7 @@
 set -e
 echo "starting time: `date`"

-export CFLAGS="-fno-unwind-tables -fno-exceptions -fno-asynchronous-unwind-tables -fomit-frame-pointer -fvisibility=hidden"
+#export CFLAGS="-fno-unwind-tables -fno-exceptions -fno-asynchronous-unwind-tables -fomit-frame-pointer -fvisibility=hidden"

 : "${ANDROID_NDK_ROOT:=$ANDROID_NDK_HOME}"
 : "${ANDROID_NDK_ROOT:=$ANDROID_NDK}"

And these modifications to the core:

diff --git a/Cargo.toml b/Cargo.toml
index ccf61341..687ca30f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -25,11 +25,11 @@ opt-level = 0
 opt-level = "z"

 [profile.release]
-lto = true
-panic = 'abort'
+lto = false
+#panic = 'abort'
 opt-level = "z"
 codegen-units = 1
-strip = true
+strip = false

 [dependencies]
 deltachat_derive = { path = "./deltachat_derive" }

Will upload it soon.

@link2xt
Copy link
Collaborator

link2xt commented Nov 17, 2024

Here is the testing .apk with debug symbols:
https://download.delta.chat/android/debug/deltachat-foss-debug-1.48.3.apk

Built from deltachat-android commit 00498b02b3a852e550b2966d502c8420ec431c02 (current main) and core v1.148.6, using the patch above to avoid stripping symbols. Inside nix develop ran scripts/ndk-make.sh --debug arm64-v8a then ./gradlew assembleDebug.

sha256sum = 036dc2055d516902e920927873c56dec63f10c61ded3498d72a06f2322bf34e3

@link2xt
Copy link
Collaborator

link2xt commented Nov 17, 2024

To get useful log, install .apk above, import backup, let it crash.
Then go offline, open the application again, go into Settings -> Advanced -> View log and save it.
The log should contain backtrace with function names instead of addresses.

The way you collected backtrace before should also work.

@link2xt link2xt transferred this issue from deltachat/deltachat-android Nov 18, 2024
@link2xt
Copy link
Collaborator

link2xt commented Nov 18, 2024

@flymarq From the log it seems to be some message:

11-17 19:46:20.664 15023 15054 🔵 DeltaChat: [accId=1] src/imap.rs:1319: Starting a full FETCH of message set "8236,8373:8375,8378".
11-17 19:46:20.735 15023 15054 🔵 DeltaChat: [accId=1] src/imap.rs:1432: Passing message UID 8236 to receive_imf().

If you have access to the Dovecot server, you can run doveadm fetch -u username@example.org text uid 8236 (replace with your user email address) to see which message it is. Removing this from the server should stop the crash.

Would be great if you can send me a copy of the message to link2xt@testrun.org so I can reproduce the crash.

@link2xt
Copy link
Collaborator

link2xt commented Nov 18, 2024

@flymarq Looking at the log again, seems the problem is while trying to load your secret key. Have you recently imported a new key into Delta Chat manually?

The issue looks similar to rpgp/rpgp#259

@flymarq
Copy link
Author

flymarq commented Nov 18, 2024

No, I did not add a new key into DeltaChat.

doveadm fetch -u username@example.org text uid 8236 finds two messages. Removing both did not fix the problem, but it takes longer to crash ...

But: I tried with network permission disabled to export the key(s) to the storage and DeltaChat crashes ... no keys are saved to the storage.

@link2xt
Copy link
Collaborator

link2xt commented Nov 18, 2024

rPGP was upgraded from 0.11 to 0.13 in v1.141.2

In Delta Chat Android v1.46.7 core was at version 1.140.2, using rPGP 0.11.
In Delta Chat Android v1.46.8 core was upgraded to 1.142.2, using rPGP 0.13.

Could you try to downgrade to v1.46.8?
I cannot find such old version in F-Droid, but gplay version is available at https://download.delta.chat/android/

@link2xt
Copy link
Collaborator

link2xt commented Nov 18, 2024

But: I tried with network permission disabled to export the key(s) to the storage and DeltaChat crashes ... no keys are saved to the storage.

This means new rPGP somehow fails to parse your secret key stored in the database. Downgrading to the version of Delta Chat with old rPGP should help.

@deltachat deltachat deleted a comment from flymarq Nov 18, 2024
@link2xt
Copy link
Collaborator

link2xt commented Nov 18, 2024

I have deleted the message with the log file above because it contains Message-IDs etc.
rPGP devs are looking into eliminating the bugs like this but it will take a week or two to get a release that can be tested.
I have also started #6214 to eliminate possibilities for similar errors in the core itself.

@flymarq
Copy link
Author

flymarq commented Nov 18, 2024

I test the older version later ...

From my knowledge I still use the first key from 2018, which:

  • is maybe outdated
  • has a now unsupported cipher or hash algorithm
  • too short key length
  • other now unsupported property

@link2xt
Copy link
Collaborator

link2xt commented Nov 18, 2024

The key should still be supported, it's definitely a bug in Delta Chat that it crashes on old key generated by Delta Chat. The key is likely a 2048-bit RSA. Delta Chat later switched to generating Curve25519 keys, but using RSA is still supported and support for it is not going to be removed.

@flymarq
Copy link
Author

flymarq commented Nov 18, 2024

Version 1.46.7 fresh install restoring from backup works without crash.
After upgrading to 1.46.8 still no crash.

@link2xt
Copy link
Collaborator

link2xt commented Nov 18, 2024

After upgrading to 1.46.8 still no crash.

Even if you receive more messages or try to export the key?

@flymarq
Copy link
Author

flymarq commented Nov 18, 2024

No, exporting keys only works with version 1.46.7.

@link2xt
Copy link
Collaborator

link2xt commented Nov 18, 2024

Then you can downgrade to 1.46.7 for now, otherwise it will crash as soon as you receive a new message and it tries to load the key.

rPGP devs are working on eliminating the code that resulted in this crash and core will update as soon as new version of the library is tagged, will take around a week likely.

@flymarq
Copy link
Author

flymarq commented Nov 18, 2024

Thank you so far for your time and efforts to find a workaround.

@link2xt
Copy link
Collaborator

link2xt commented Dec 5, 2024

@flymarq This is likely fixed in core 1.151.5 which contains rPGP 0.14.2 with bugfixes. It is included in the release candidate https://download.delta.chat/android/beta/deltachat-foss-debug-1.50.1.apk, would be great if you can try to import backup there and report if it works.

@flymarq
Copy link
Author

flymarq commented Dec 6, 2024

Tested and it works without crash after importing the backup.

@link2xt
Copy link
Collaborator

link2xt commented Dec 7, 2024

Great, then we can close the issue.

@link2xt link2xt closed this as completed Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working
Projects
None yet
Development

No branches or pull requests

2 participants