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

Joplin stuck in a loop trying to decrypt resources #2257

Closed
ioogithub opened this issue Jan 2, 2020 · 5 comments
Closed

Joplin stuck in a loop trying to decrypt resources #2257

ioogithub opened this issue Jan 2, 2020 · 5 comments
Labels
bug It's a bug high High priority issues

Comments

@ioogithub
Copy link

ioogithub commented Jan 2, 2020

Problem

I have installed a fresh installation of Joplin on my Android phone. It is now stuck in a loop trying to decode resources and failing.

Environment

Joplin version: 10.0.312
Platform:
OS specifcs: Android 9.0

Steps To Reproduce

  1. Install Joplin apk
  2. Configure sync
  3. Start sync.

Describe what you expected to happen:

I expect Joplin will continue to download and decrypt resources and finish completely.

Logfile

This entry is in the log over and over:

Date,Level,Message
07-22T07:31:19,30,"""DecryptionWorker: xxxxxxxxxxxxxx decryption has failed more than 2 times - skipping it.

However it doesn't skip it, it continues to try to decrypt the items and is not stuck in a loop. The logs fills up with these messages and Joplin is stuck in a loop. On the main screen it flashes "Decrypting items: 0/2, 1/2, 2/2. Over and over and never stops.

On the Status screen, it reports:
Items that cannot be decrypted.

The two items are listed here with Retry buttons next to them. I clicked on the buttons, it tried to decrypt them again but this leads to the same problem: the failed decryption loop. Instead of retry buttons, can you add a delete button because at this point I am stuck, I can't remove the items and Joplin is stuck in a never-ending decryption loop.

The file it doesn't like is a png file, it is 16,190k in size and the specific error is: "Error: json decode: this isn't json!

What can I do to fix this issue? I have deleted the items from the PC version and synced with the cloud. I can see that Joplin on Android has also picked up on the synced changes and the items are no longer attached to the notes but it keeps trying to decrypt these items and failing. There doesn't appear to be anyway to stop this loop.

I have synced this dataset to Joplin for Android many times but never with this new version.

I believe the issue is similar to this one: #1758

@ioogithub ioogithub added the bug It's a bug label Jan 2, 2020
@laurent22 laurent22 self-assigned this Jan 2, 2020
@ioogithub
Copy link
Author

ioogithub commented Jan 3, 2020

I have more information to share on this issue.

I believe it is actually two bugs:

Bug 1: "DecryptionWorker: error for: xxxxxxxx (resources)", "Error: json decode: this isn't json!

Bug 2: DecryptionWorker: xxxxxxx decryption has failed more than 2 times - skipping it"

Bug 1 causes Bug 2 and the error message reported by Bug 2 is erroneous as it doesn't actually skip it, it sends Joplin into a decode loop from which it cannot recover.

I have wiped my Android device clean and tried to do a sync 8 times over the last 24 hours. Every time, I get to the sync loop, it reports different files as corrupt json "Bug 1". After this I delete these files from the sync target and attempt to resync and it reports two new files... etc. I have removed 16 files. None of them are large, they are all 20-150k in size, all different file types: pdf, jpg, bmp, xls etc.

I also believe that the error in Bug 1 is also erroneous. To test if the files are actually corrupt json as the Android app log is suggesting, I did a fresh Joplin sync on my Linux box. I pulled down the same data from the same sync target as the android version and it was able to decode all files successfully without any errors. I am looking now at the desktop Joplin with the files that the Android reported were corrupt and they are decided normally.

This makes sense because the files that the Android version is choking on are actually files I have had in my data set since my first Joplin installation. As such they have been synced and decoded over 50 times on multiple platforms without any error until this point.

This version works: Joplin 1.0.174 (linux- Debian)
This version doesn't work: Joplin 1.0.312 (Android 9.0)

I will try to install a previous version Android version next and sync as I can't use this version, there is no way to get past the sync loop.

I believe this is the same or a similar issue as the user reported here: https://discourse.joplinapp.org/t/constant-prompt-of-decrypting-items/3159

@laurent22 laurent22 removed their assignment Jan 8, 2020
@laurent22 laurent22 added the high High priority issues label Jan 8, 2020
@rcrx
Copy link

rcrx commented Jan 19, 2020

Having this problem, too, across several devices and many resources.

@rcrx
Copy link

rcrx commented Jan 19, 2020

Also, this:
Screenshot from 2020-01-18 21-50-21

@cerealkella
Copy link

I had this issue as well which initiated in version 1.0.179 and persisted in version 1.0.179 on Manjaro. I checked the local resources folder and there was no file named the same as what the log was complaining about. I searched joplin for the resource id and found the note, then deleted the note (this may not have been the thing to do). I did a sync and the decryption loop persisted. I then closed Joplin, made a backup copy of the database, opened the database in DBeaver and ran the following queries (where 60ecd7% uniquely identifies the resource id):

delete from resources 
where id like '60ecd7%';
delete from sync_items
where item_id like '60ecd7%';
delete from note_resources
where resource_id like '60ecd7%';
delete from resource_local_states
where resource_id like '60ecd7%';

This resolved the issue, the log is clean again, and my processor isn't slammed with a runaway decryption process. Hopefully this will help someone else, or maybe there's an easier/better way to fix the issue?

@operator207
Copy link

I had this issue as well which initiated in version 1.0.179 and persisted in version 1.0.179 on Manjaro. I checked the local resources folder and there was no file named the same as what the log was complaining about. I searched joplin for the resource id and found the note, then deleted the note (this may not have been the thing to do). I did a sync and the decryption loop persisted. I then closed Joplin, made a backup copy of the database, opened the database in DBeaver and ran the following queries (where 60ecd7% uniquely identifies the resource id):

delete from resources 
where id like '60ecd7%';
delete from sync_items
where item_id like '60ecd7%';
delete from note_resources
where resource_id like '60ecd7%';
delete from resource_local_states
where resource_id like '60ecd7%';

This resolved the issue, the log is clean again, and my processor isn't slammed with a runaway decryption process. Hopefully this will help someone else, or maybe there's an easier/better way to fix the issue?

Thank you! This fixed an issue on one of my machines. the two notes were decrypted, I could search for the resource ID and see the note just fine, but the decryption process was spinning away at on my CPU. I wanted to let you know that your post did indeed help someone else.

@lock lock bot locked and limited conversation to collaborators Apr 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug It's a bug high High priority issues
Projects
None yet
Development

No branches or pull requests

5 participants