Closed thanasistrisp closed 2 years ago
Thank you for reporting this. Would you please post a logcat, as per the error message?
Recording logcat with logcat reader having root access to my android. I attach you two files: all logcats for your application and a logcat that contain only errors. The scheduled export that caused the error was scheduled at 12.37. However, I think this is the critical error that causes the problem:
Failed to create document
android.os.ParcelableException: java.io.FileNotFoundException: Temp folder could not be created: /null/nextcloud/tmp/thanasistrisp@yahoo.com@shared02.opsone-cloud.ch
at android.os.ParcelableException$1.createFromParcel(ParcelableException.java:82)
at android.os.ParcelableException$1.createFromParcel(ParcelableException.java:79)
at android.os.Parcel.readParcelable(Parcel.java:3293)
at android.os.Parcel.createExceptionOrNull(Parcel.java:2380)
at android.os.Parcel.createException(Parcel.java:2369)
at android.os.Parcel.readException(Parcel.java:2352)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:190)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
at android.content.ContentProviderProxy.call(ContentProviderNative.java:732)
at android.content.ContentResolver.call(ContentResolver.java:2415)
at android.provider.DocumentsContract.createDocument(DocumentsContract.java:1377)
at androidx.documentfile.provider.TreeDocumentFile.createFile(TreeDocumentFile.java:53)
at androidx.documentfile.provider.TreeDocumentFile.createFile(TreeDocumentFile.java:45)
at com.github.tmo1.sms_ie.ExportWorker$doWork$1.invokeSuspend(ExportWorker.kt:52)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8653)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: java.io.FileNotFoundException: Temp folder could not be created: /null/nextcloud/tmp/thanasistrisp@yahoo.com@shared02.opsone-cloud.ch
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.os.ParcelableException.readFromParcel(ParcelableException.java:56)
... 23 more
[08-19 12:37:00.565 9321:9321 W/DocumentsContract]
Failed to create document
android.os.ParcelableException: java.io.FileNotFoundException: Temp folder could not be created: /null/nextcloud/tmp/thanasistrisp@yahoo.com@shared02.opsone-cloud.ch
at android.os.ParcelableException$1.createFromParcel(ParcelableException.java:82)
at android.os.ParcelableException$1.createFromParcel(ParcelableException.java:79)
at android.os.Parcel.readParcelable(Parcel.java:3293)
at android.os.Parcel.createExceptionOrNull(Parcel.java:2380)
at android.os.Parcel.createException(Parcel.java:2369)
at android.os.Parcel.readException(Parcel.java:2352)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:190)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
at android.content.ContentProviderProxy.call(ContentProviderNative.java:732)
at android.content.ContentResolver.call(ContentResolver.java:2415)
at android.provider.DocumentsContract.createDocument(DocumentsContract.java:1377)
at androidx.documentfile.provider.TreeDocumentFile.createFile(TreeDocumentFile.java:53)
at androidx.documentfile.provider.TreeDocumentFile.createFile(TreeDocumentFile.java:45)
at com.github.tmo1.sms_ie.ExportWorker$doWork$1.invokeSuspend(ExportWorker.kt:68)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8653)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: java.io.FileNotFoundException: Temp folder could not be created: /null/nextcloud/tmp/thanasistrisp@yahoo.com@shared02.opsone-cloud.ch
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.os.ParcelableException.readFromParcel(ParcelableException.java:56)
... 23 more
Thank you - I'll look into this.
In my testing, I only use internal storage, and although I have my own Nextcloud instance, I don't use it with Android, so I have little experience with Android and cloud storage.
Ok thanks. The weird is that the error happens only at export stage. At manual method from main menu it works correctly with nextoud.
I also noticed that in signal app nextcloud backup works as expected. So if you have time take a look in source code @tmo1 .
The weird is that the error happens only at export stage. At manual method from main menu it works correctly with nextoud.
The code flow for scheduled export is considerably different from that of direct export. In particular, when scheduling, the user selects a directory, not a file, and SMS Import / Export later tries to create a file in that directory, as opposed to direct export, where the user selects an output file directly. There have apparently been many problems similar to yours with using Nextcloud as an export / backup destination: see here, here, here, here, here, here, here, and here.
At this point, I'm not sure whether your reported problem is with SMS Import / Export or Nextcloud; we're going to continue the discussion at Nextcloud's issue tracker here.
Exactly the same problem here.
SMS Import / Export version: 1.4.2 Nextcloud App version: 3.21.0 (F-Droid version) Nextcloud server version: 24.0.4
Logcat for scheduled export:
[08-24 17:10:00.172 26197:13406 D/DocumentsStorageProvider]
createDocument(), id=66224fecb350e86aa7ea9da32c482c9b/378
[08-24 17:10:00.206 26197:13406 D/OwnCloudClient #0]
REQUEST PUT /remote.php/dav/files/username//some/remote/path/messages-2022-08-24.json
[08-24 17:10:00.211 26197:13406 E/DocumentsStorageProvider]
RemoteOperationResult{mSuccess=false, mHttpCode=-1, mHttpPhrase='null', mException=android.os.NetworkOnMainThreadException, mCode=HOST_NOT_AVAILABLE, message='null', getLogMessage='Unexpected exception'}
[08-24 17:10:00.212 26197:13406 E/DatabaseUtils]
Writing exception to parcel
android.os.ParcelableException: java.io.FileNotFoundException: Failed to upload document with path /some/remote/path/messages-2022-08-24.json
at android.provider.DocumentsProvider.call(DocumentsProvider.java:1080)
at android.content.ContentProvider.call(ContentProvider.java:2464)
at android.content.ContentProvider$Transport.call(ContentProvider.java:512)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:295)
at android.os.Binder.execTransactInternal(Binder.java:1179)
at android.os.Binder.execTransact(Binder.java:1143)
Caused by: java.io.FileNotFoundException: Failed to upload document with path /some/remote/path/messages-2022-08-24.json
at com.owncloud.android.providers.DocumentsStorageProvider.createFile(DocumentsStorageProvider.java:567)
at com.owncloud.android.providers.DocumentsStorageProvider.createDocument(DocumentsStorageProvider.java:486)
at android.provider.DocumentsProvider.callUnchecked(DocumentsProvider.java:1139)
at android.provider.DocumentsProvider.call(DocumentsProvider.java:1078)
... 5 more
[08-24 17:10:00.225 26197:13406 D/DocumentsStorageProvider]
createDocument(), id=66224fecb350e86aa7ea9da32c482c9b/378
[08-24 17:10:00.265 26197:13406 D/OwnCloudClient #0]
REQUEST PUT /remote.php/dav/files/username//some/remote/path/call-logs-2022-08-24.json
[08-24 17:10:00.266 26197:13406 D/AdvancedSslSocketFactory]
Creating SSL Socket with remote mydomain.example:443, local null:0, params: org.apache.commons.httpclient.params.HttpConnectionParams@982e166
[08-24 17:10:00.267 26197:13406 D/AdvancedSslSocketFactory]
... with connection timeout 60000 and socket timeout 60000
[08-24 17:10:00.269 26197:13406 E/DocumentsStorageProvider]
RemoteOperationResult{mSuccess=false, mHttpCode=-1, mHttpPhrase='null', mException=android.os.NetworkOnMainThreadException, mCode=HOST_NOT_AVAILABLE, message='null', getLogMessage='Unexpected exception'}
[08-24 17:10:00.269 26197:13406 E/DatabaseUtils]
Writing exception to parcel
android.os.ParcelableException: java.io.FileNotFoundException: Failed to upload document with path /some/remote/path/call-logs-2022-08-24.json
at android.provider.DocumentsProvider.call(DocumentsProvider.java:1080)
at android.content.ContentProvider.call(ContentProvider.java:2464)
at android.content.ContentProvider$Transport.call(ContentProvider.java:512)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:295)
at android.os.Binder.execTransactInternal(Binder.java:1179)
at android.os.Binder.execTransact(Binder.java:1143)
Caused by: java.io.FileNotFoundException: Failed to upload document with path /some/remote/path/call-logs-2022-08-24.json
at com.owncloud.android.providers.DocumentsStorageProvider.createFile(DocumentsStorageProvider.java:567)
at com.owncloud.android.providers.DocumentsStorageProvider.createDocument(DocumentsStorageProvider.java:486)
at android.provider.DocumentsProvider.callUnchecked(DocumentsProvider.java:1139)
at android.provider.DocumentsProvider.call(DocumentsProvider.java:1078)
... 5 more
@thanasistrisp: As per my previous message and here, with the latest commit to SMS Import / Export, exporting to Nextcloud, both manually and via scheduling, works correctly in my testing, so I'm closing this issue. If you continue to see the problem you originally reported, and you can reproduce it using the latest SMS Import / Export code and a current version of Nextcloud and its Android app, please update this report or the Nextcloud one I mentioned above.
OK great. So will you update the app on fdroid?
OK great. So will you update the app on fdroid?
If I don't encounter any further problems or regressions, I'll try to release a version with the fix tomorrow, at which point you'll be able to download the APK from Github. F-Droid should have the new version within a few days.
@tmo1 could you also make a pull request at nextcloud android app to solve this problem for other apps like signal, aegis, etc?
@thanasistrisp based on the conversations I guess it's not a Nextcloud related problem (but correct me if I'm wrong), so a pull request for Nextcloud app would be pointless. All other apps will have to make it's own (and maybe different) fix in their code.
I guess it's not a Nextcloud related problem (but correct me if I'm wrong)
Whether it is or is not a Nextcloud problem is actually an interesting question. The situation as I understand it is as follows:
Main
to IO
.
When manually export no crash encountered. However, when I try to schedule export it crashes. I use android 11 and I try to save at nextcloud location from system picker. The error message is
Export unsuccessful - see logcat for more details
. However, when I choose a folder inside internal storage works perfectly.