tmo1 / sms-ie

SMS Import / Export is a simple Android app that imports and exports SMS and MMS messages, call logs, and contacts from and to JSON / NDJSON files.
GNU General Public License v3.0
362 stars 38 forks source link

Import Fails after ~27,000 SMS and ~21,000 MMS #28

Closed gregordinary closed 2 years ago

gregordinary commented 2 years ago

I have a backup taken from an Asus Zenfone 8 Flip, running Android 12. JSON is about 15GB. I've attempted the import twice. It gets through all ~27,000 SMS messages on import, however the application suddenly quits after it gets to around 21,000 MMS messages imported. That's out of about 48,000 MMS.

The JSON includes the binary data / images in the MMS as well.

tmo1 commented 2 years ago

Thanks for reporting this. Please specify the version of the program used for export and import, and please provide a logcat.

gregordinary commented 2 years ago

SMS Import / Export Version 1.4.1

I also tested this on a OnePlus 5T running Android 10 with the same results. Not certain if it fails at precisely the same point, but it's certainly close.

Attached some relevant logs from each device, filtered for tmo1.

They both seem to contain the following "unable to find or allocate a thread ID" error.


Process: com.github.tmo1.sms_ie, PID: 6287
java.lang.IllegalArgumentException: Unable to find or allocate a thread ID.
    at android.provider.Telephony$Threads.getOrCreateThreadId(Telephony.java:2277)
    at com.github.tmo1.sms_ie.ImportExportKt$importMessages$2.invokeSuspend(ImportExport.kt:610)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)```
gregordinary commented 2 years ago

Out of curiosity, I enabled debug options and had it import only MMS to see if it had more to do with total count, or just the MMS operation. This round it imported 0 SMS (as expected) and again failed at the same place between 20k & 21k MMS imported. I tested this on the OnePlus 5T. Same "Unable to find or allocate a thread ID".

tmo1 commented 2 years ago

Thank you for the additional details.

I'm perplexed by the error message: I can find almost no reference to it online other than citations of the Android source code in which it appears (with the exception of this issue, which doesn't seem relevant to our case).

I want to see the details of the message that's triggering the exception - here's a slightly modified version of the app that when encountering the problematic message will log its metadata and recipient list (as well as the exception itself), and then skip importing the message and proceed to the next message. Would you please run this version and post the relevant portion of the logcat (or send it to me privately)?

Feel free to sanitize the log by removing any details you consider sensitive, but I'm really interested in what the recipient list looks like.

gregordinary commented 2 years ago

Thanks for taking a look, I appreciate it! I re-ran the import on the older OnePlus 5T and it completed the import successfully. Looking through the logs, I don't see the same error repeated this time (on the 31st). I left the logs mostly unfiltered, only removed the wifi network info, other than that, everything is in tact.

I see some errors about receiving texts because I didn't have it in Airplane Mode while running the import. Let me know if there's anything else I can run / dig up to assist!

tmo1 commented 2 years ago

Thanks for the logs. If you do encounter the problem again, please see if you can reproduce it using the modified version of the app I provided above and capture the log. Beyond that, I'm not sure what more I can do at this point, without a way to reproduce and study the problem.

Thanks again, and please do report any further problems or relevant details that you encounter.