Sorry, I don't get a result. The scan-process is very fast. I have more than 3000 notes. The whole process stops after a few seconds without a result.
So, it happens again. As I wrote above, I created two summary-notes. Now, after synching many devices for hours (because I used the function "Re-upload local data to sync target") I lost again attachments in the two test-notes.
In the first note I lost 4 out of 5 attachments, in the other note 3 out of 5 attachments. I don't know why only 3 in the second note.
I sync one device after the other:
- Mac 1,
- Android-Device 1,
- Windows PC 1,
- Mac 2
- iPad
Here are some line from the log on my Mac 2 (last synced computer) with the id from one example missing resource (1bb809e16fa24d1997d859860cd3f4da):
2022-04-21 22:05:44: Synchronizer: "Sync: fetchingProcessed: Processing fetched item"
2022-04-21 22:05:45: Synchronizer: "Sync: deleteLocal: remote has been deleted: Resource: (Local 1bb809e16fa24d1997d859860cd3f4da): (Remote 1bb809e16fa24d1997d859860cd3f4da.md)"
The following log is from my Windows PC 1. (third synced computer)
2022-04-21 18:21:49: "ResourceService::deleteOrphanResources:", "["1bb809e16fa24d1997d859860cd3f4da","70a3be54bc3234122aaffcfe3bcbce30","778c0c71c85779898fd0f28bcfba471d","91fd0aad9c3d43728f21376f926f745b","967a1548904f6eb2b44f6c7647e872d5","c471f8b994a84442982b00d07eee9b03","deba57370f7b4146ad41e9768484749a"]"
2022-04-21 18:38:53: Synchronizer: "Sync: createLocal: remote exists but local does not: (Remote 1bb809e16fa24d1997d859860cd3f4da.md)"
2022-04-21 21:35:59: Synchronizer: "Sync: deleteRemote: local has been deleted: (Remote 1bb809e16fa24d1997d859860cd3f4da)"
2022-04-21 21:36:57: Synchronizer: "Sync: deleteLocal: remote has been deleted: Resource: (Local 1bb809e16fa24d1997d859860cd3f4da): (Remote 1bb809e16fa24d1997d859860cd3f4da.md)"
It seams that the joplin-version on this device decided to delete the resources.
Log from Mac 1:
2022-04-20 20:17:03: Synchronizer: "Sync: createRemote: remote does not exist, and local is new and has never been synced: Resource: (Local 1bb809e16fa24d1997d859860cd3f4da)"
I can not export the logs from my android device 1 (second synced device). When trying to export the profile I get the following messege:
Alert. Could not export files: (ENOENT: open failed: EPERM (Operation not permitted), open 'storage/0000-0000/Joplin-Export/log.sqlite'
I few minutes ago, I checked my other devices and one after the other delete the resources:
So, I hope this helped to find the problem.
Best regards
Kay
Maybe this is helpful.
2022-04-22 19:27:03: "ResourceService::deleteOrphanResources:", "["e07b6df3aa82967751f9e3324e7f78f8","e6b19e9188fa4abd90a90147cf4d9d4a"]"
2022-04-22 19:27:05: joplin.plugins: "Finished running onStart handler: plugin.calebjohn.rich-markdown (Took 33236ms)"
2022-04-22 19:27:05: "ResourceService::deleteOrphanResources: Skipping deletion of resource e07b6df3aa82967751f9e3324e7f78f8 because it is still referenced in note b54ee80e5f4546ba8d52a02f7a53eed9. Re-indexing note content to fix the issue."
2022-04-22 19:27:08: Synchronizer: "Sync: deleteRemote: local has been deleted: (Remote b0a598eb4ce7441d8f1c3bee10d9a4ea)"
What means "Re-indexing note content to fix the issue."? Should I re-index or does joplin do this?
It means the resource was marked as orphaned (i.e. not used in any notes) but when Joplin wanted to delete it, turned out it in fact was referenced.
Not sure why this happened.
I wonder if it's something like this:
- Client 1: Note 1 is created
- Client 1: Note 2 is created, with attachment 1
- Client 1: sync
- Client 2: sync
- Client 1: Resource 1 is copied to note 1
- Client 1: Note 2 is deleted
- Client 1: sync, but sync process is cancelled or stopped, and only note deletion is synced
- Client 2: sync, and delete note 2, but doesn't update note 1
- Client 2: Since it didn't get the changes to note 1, it now sees resource 1 as being orphaned, and delete it a few days later
That seems convoluted though, so it's strange that it could happen often.
A workaround is to never copy resources from one note to another, and just reattach the file.
Yes, the process is described correct. But I don't cancelled the sync, especially when I test it. I can reproduce it with other notes, if you want.
And, the resource is not instantly orphaned. I tried it again after updating to version 2.8.8 a few days ago. First, I thought, the problem is fixed. A day later, the ressource was orphaned.
Thanks, I still use the workaround.
So, after reading this - are you guys saying that I can't copy attachment code from one note to another, because if I ever delete the first note, I may lose that attachment ?
This will have a huge impact on my workflow. I copy attachments between notes all the time.
Is there a way to find the notes which already had attachments pasted from other notes ?
Also, am I reading it right that there's no expected fix for this ?
If appropriate and reliable replication steps can be found to replicate it then there is a good chance that it can be fixed, without it we are only guessing as to what the cause could be because in theory it shouldn't happen.
Laurent's workaround is just a way to guarantee it won't happen in lieu of being able to identify and fix the root issue.
So, after weeks with no problem (since June), I noticed again some missing attachments.
I suspect a computer that I haven't used for a long time. On this computer there was installed an old vision of Joplin: 2.6.10. But there are no usefull entries in the log.
As before only old attachments were affected. Maybe the db is in some kind corrupted? Is it possible to start from scratch? Or to rebuild the database?