[Bug] Still cannot export unecrypted backup
Testsecure still crashes when trying to export an unencrypted backup. I am worried because I have no way to back up my text messages. I uploaded a debug log to http://hastebin.com/riwonataho immediately upon reopening after the crash.
I am on an Xperia Z1s from tmobile. If you need additional info, I am happy to provide it.
For posterity:
E/AndroidRuntime(14890): FATAL EXCEPTION: AsyncTask #2
E/AndroidRuntime(14890): java.lang.RuntimeException: An error occured while executing doInBackground()
E/AndroidRuntime(14890): at android.os.AsyncTask$3.done(AsyncTask.java:299)
E/AndroidRuntime(14890): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
E/AndroidRuntime(14890): at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
E/AndroidRuntime(14890): at java.util.concurrent.FutureTask.run(FutureTask.java:239)
E/AndroidRuntime(14890): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
E/AndroidRuntime(14890): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
E/AndroidRuntime(14890): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
E/AndroidRuntime(14890): at java.lang.Thread.run(Thread.java:841)
E/AndroidRuntime(14890): Caused by: java.lang.NullPointerException: Input string was null.
E/AndroidRuntime(14890): at org.whispersystems.textsecure.util.Base64.decode(Base64.java:1274)
E/AndroidRuntime(14890): at org.whispersystems.textsecure.util.Base64.decode(Base64.java:1244)
E/AndroidRuntime(14890): at org.whispersystems.textsecure.crypto.MasterCipher.decodeAndDecryptBytes(MasterCipher.java:145)
E/AndroidRuntime(14890): at org.whispersystems.textsecure.crypto.MasterCipher.decryptBody(MasterCipher.java:83)
E/AndroidRuntime(14890): at org.thoughtcrime.securesms.database.EncryptingSmsDatabase$DecryptingReader.getBody(EncryptingSmsDatabase.java:155)
E/AndroidRuntime(14890): at org.thoughtcrime.securesms.database.SmsDatabase$Reader.getCurrent(SmsDatabase.java:542)
E/AndroidRuntime(14890): at org.thoughtcrime.securesms.database.SmsDatabase$Reader.getNext(SmsDatabase.java:524)
E/AndroidRuntime(14890): at org.thoughtcrime.securesms.database.PlaintextBackupExporter.exportPlaintext(PlaintextBackupExporter.java:50)
E/AndroidRuntime(14890): at org.thoughtcrime.securesms.database.PlaintextBackupExporter.exportPlaintextToSd(PlaintextBackupExporter.java:19)
E/AndroidRuntime(14890): at org.thoughtcrime.securesms.ExportFragment$ExportPlaintextTask.doInBackground(ExportFragment.java:105)
E/AndroidRuntime(14890): at org.thoughtcrime.securesms.ExportFragment$ExportPlaintextTask.doInBackground(ExportFragment.java:91)
E/AndroidRuntime(14890): at android.os.AsyncTask$2.call(AsyncTask.java:287)
E/AndroidRuntime(14890): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
E/AndroidRuntime(14890): ... 4 more
I did some troubleshooting.
I restarted the device and re-tried. The process continued for 4-5 minutes, rather than the ~30 sec it took for the posted crash log. But the result was the same.
I tried force-stopping the app from the app menu, then retried an export. The process failed after ~30 sec.
I tried dumping my key from memory, re-entering it, and retried the backup. Another failure after ~30 sec.
This pattern repeats: if I reboot the phone and try again, time to failure is longer than subsequent attempts.
Thanks for your report and troubleshooting @birdbrain5381 This seems to me that the error not only occurs if you export but also if you open the specific conversation, that is failing?!
@moxie0 null check in public String decryptBody(String body) in EncryptingSmsDatabase.java? Though I guess there should be no empty encrypted bodys.
@mcloo I apologize if I was unclear. I only receive the error upon unencrypted export. Every function works well oherwise.
@birdbrain5381 I was only assuming that this error could occur if you open the conversation that contains the faulting message (that crashes the export). So I was unclear ;-) Not sure if I'm right here, but it worth a trying opening all your conversations. I know this could take a while...
@mcloo I just opened all my convos (not too bad, had ~50), and they all opened reliably. I scrolled up in a few, but only a swipe. No issues opening or reading the messages.
In light of the previous troubleshooting, would it be beneficial to reboot the phone, reproduce the bug, and send that debug log as well (with the longer time to failure)? The one I previously provided was not from a fresh reboot and attempt.
Thanks a lot for trying @birdbrain5381
A log after reboot would help to determine if it is the same issue. So yes, if you can spare the the.
@mcloo here's the debug log after a fresh reboot: http://hastebin.com/sipovakuqu
Thanks again. That is the same issue. @moxie0 any idea what the reason for the empty body could be? I suspect an invalid DB entry.
Nope no idea. My suggestion is to have EncryptingSmsDatabase return a body with an empty string if the ciphertext is null.
@birdbrain5381 once the fix is in. It would be great if you could track down the failing message (then with an empty text) in the export xml. Maybe we could get some more information were the empty message resulted from. hang on and thanks for your patience!
@mcloo I can certainly try! I'm curious myself. You guys are now sure it's a blank message somewhere? I had a terrible streak of bad luck. The phone is out of commission with a mysteriously cracked screen (it was flat on a table). The touchscreen is broken, but I can still use a mouse via USB OTG (thank god I don't have iOS!). I may not be able to transfer my messages :( but I can try to back up the app with Sony's integrated backup and see if it preserves anything. If that works, I'll try the backup on the replacement phone too. Just to get another debug log if needed.
I know you closed this, but I got the new phone, and the sony backup saved all the conversations (even my key). I tried a backup and failed again, so this is at least happening across devices. I will try a new export on the next update, and look thru the .xml to find a blank message.
@birdbrain5381 this issue is closed, because the fix is commited to the master branch. The fix will be available with the next release of TextSecure (and no, I unfortunately don't know when this will be ;-) )
@birdbrain5381 now you can update and try agin