beemdevelopment / Aegis

A free, secure and open source app for Android to manage your 2-step verification tokens.
https://getaegis.app
GNU General Public License v3.0
8.83k stars 371 forks source link

[BUG] Nextcloud Backup stops working with createFile returned null #1426

Open Bruceforce opened 2 months ago

Bruceforce commented 2 months ago

Version

3.1

Source

Google Play

Vault encryption

Yes (with biometric unlock)

Device

Poco F2 Pro

Android version

12

ROM

No response

Steps to reproduce

  1. Enable Auto Backup.
  2. Configure a Nextcloud folder as target for the backups.
  3. Don't change anything for some time (sorry it's unclear to me what exactly triggers this)

What do you expect to happen?

Nextcloud backups should continue to work also if there was no backup in a few weeks.

What happens instead?

Nextcloud backups stop working after some time. I get an error com.beemdevelopment.aegis.vault.VaultManagerException: createFile returned null" if I click on Details.

Log

No response

alexbakker commented 2 months ago

This is likely to be an issue at Nextcloud's end. It can't hurt to take a look at the logs to see if there's anything that points us in the right direction though.

Please capture a log using ADB while reproducing the issue and share it with us: https://github.com/beemdevelopment/Aegis/blob/master/CONTRIBUTING.md#bug-reports. Just Aegis' logs won't suffice, so please exclude the log filter for Aegis.

Bruceforce commented 2 months ago

Will do. But it might take a time because I just "re-enabled" the backup granting access to the folder which usually fixes the issue for a couple of days. Once it comes back I'll capture some logs and post them here.

Bruceforce commented 1 month ago

Hey @alexbakker I grabbed the debug log. full-debug.log

alexbakker commented 3 weeks ago

Thanks. Relevant portion from the log:

08-11 12:09:16.890 14674 18746 I VaultBackupManager: Creating backup at content://org.nextcloud.documents/tree/083520c769d3fadce4db0d5a8f4ba118/2312/document/083520c769d3fadce4db0d5a8f4ba118/2312: aegis-backup-20240811-120916.json
08-11 12:09:16.894 14674 18746 E ActivityThread: Failed to find provider info for org.nextcloud.documents
08-11 12:09:16.894 14674 18746 W DocumentFile: Failed query: java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.database.Cursor.moveToNext()' on a null object reference
08-11 12:09:16.896 14674 18746 E ActivityThread: Failed to find provider info for org.nextcloud.documents
08-11 12:09:16.896 14674 18746 W DocumentsContract: Failed to create document
08-11 12:09:16.896 14674 18746 W DocumentsContract: java.lang.IllegalArgumentException: Unknown authority org.nextcloud.documents
08-11 12:09:16.896 14674 18746 W DocumentsContract:     at android.content.ContentResolver.call(ContentResolver.java:2447)
08-11 12:09:16.896 14674 18746 W DocumentsContract:     at android.provider.DocumentsContract.createDocument(DocumentsContract.java:1380)
08-11 12:09:16.896 14674 18746 W DocumentsContract:     at androidx.documentfile.provider.TreeDocumentFile.createFile(SourceFile:23)
08-11 12:09:16.896 14674 18746 W DocumentsContract:     at com.beemdevelopment.aegis.vault.VaultBackupManager.createBackup(SourceFile:88)
08-11 12:09:16.896 14674 18746 W DocumentsContract:     at com.beemdevelopment.aegis.vault.VaultBackupManager$$ExternalSyntheticLambda0.run(SourceFile:12)
08-11 12:09:16.896 14674 18746 W DocumentsContract:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
08-11 12:09:16.896 14674 18746 W DocumentsContract:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
08-11 12:09:16.896 14674 18746 W DocumentsContract:     at java.lang.Thread.run(Thread.java:1012)
08-11 12:09:16.896 14674 18746 E VaultBackupManager: Unable to create backup: com.beemdevelopment.aegis.vault.VaultRepositoryException: createFile returned null
08-11 12:09:16.897 14674 18746 W System.err: com.beemdevelopment.aegis.vault.VaultRepositoryException: createFile returned null
08-11 12:09:16.897 14674 18746 W System.err:    at com.beemdevelopment.aegis.vault.VaultBackupManager.createBackup(SourceFile:346)
08-11 12:09:16.897 14674 18746 W System.err:    at com.beemdevelopment.aegis.vault.VaultBackupManager$$ExternalSyntheticLambda0.run(SourceFile:12)
08-11 12:09:16.897 14674 18746 W System.err:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
08-11 12:09:16.897 14674 18746 W System.err:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
08-11 12:09:16.897 14674 18746 W System.err:    at java.lang.Thread.run(Thread.java:1012)

In particular:

Failed to find provider info for org.nextcloud.documents

You do still have the Nextcloud app installed and are logged into it, right? And you didn't uninstall / reinstall Nextcloud in the mean time after you enabled automatic backups in Aegis?

Bruceforce commented 3 weeks ago

You do still have the Nextcloud app installed and are logged into it, right?

Correct. Nextcloud works like normal and I'm still logged in when receiving the error. Don't know if this matters, but Nextcloud is only accessible if I'm connected via VPN to my network, but the Aegis backup fails also when I'm home.

And you didn't uninstall / reinstall Nextcloud in the mean time after you enabled automatic backups in Aegis?

Nope. Nextcloud was installed all the time. As mentioned initially it fails after some amount of time, but this happens every few weeks. That's why I provided the log so late.

alexbakker commented 2 weeks ago

I'm not sure what could be going on here. I would have to dig into how document providers are managed by Android and what might cause Android to forget about one. Either way, I don't think there's anything we can do about it from Aegis' end.