joplin icon indicating copy to clipboard operation
joplin copied to clipboard

Joplin folder sync stalls on "Cancelling": EBUSY: resource busy or locked

Open mgrandi opened this issue 1 year ago • 21 comments

duplicate of #8146

let me make it known that stale bot is a annoyance and just leads to valid bug reports getting closed down because you miss an email saying "please bump it"

Joplin when running for a long time sometimes gets in a state where the sync is "Cancelling..." and makes no progress

I have a folder sync set up to a one drive folder, as i am not allowed to use API sync to one drive

I set up debug logging in Joplin and let it run for a week, until i got to this error:

2023-05-05 08:06:57: PluginRunner: "Got message (3): joplin.data.get", "[["tags"],{"fields":"title, id, updated_time","order_by":"updated_time","order_dir":"DESC","limit":10,"page":1}]"
2023-05-05 08:06:58: Synchronizer: "BasicDelta: Report: {"timestamp":1683169807038,"older":4266,"newer":0,"equal":1}"
2023-05-05 08:06:58: Synchronizer: "Sync: fetchingTotal: Fetching delta items from sync target"
2023-05-05 08:06:58: FileApi: "delete C:\Users\mgrandi\OneDrive - Microsoft\JoplinSync/locks/1_1_339fa57187c64b44a9fa462e73aca41c.json"
2023-05-05 08:06:58: "Could not run background sync:"
2023-05-05 08:06:58: "Error: Error: EBUSY: resource busy or locked, unlink 'C:\Users\mgrandi\OneDrive - Microsoft\JoplinSync\locks\1_1_339fa57187c64b44a9fa462e73aca41c.json'. Path: C:\Users\mgrandi\OneDrive - Microsoft\JoplinSync/locks/1_1_339fa57187c64b44a9fa462e73aca41c.json
Code: EBUSY
Error: Error: EBUSY: resource busy or locked, unlink 'C:\Users\mgrandi\OneDrive - Microsoft\JoplinSync\locks\1_1_339fa57187c64b44a9fa462e73aca41c.json'. Path: C:\Users\mgrandi\OneDrive - Microsoft\JoplinSync/locks/1_1_339fa57187c64b44a9fa462e73aca41c.json
    at FileApiDriverLocal.fsErrorToJsError_ (C:\Users\mgrandi\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\@joplin\lib\file-api-driver-local.js:20:18)
    at FileApiDriverLocal.delete (C:\Users\mgrandi\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\@joplin\lib\file-api-driver-local.js:174:15)"
2023-05-05 08:06:58: "Setting up recurrent sync with interval 300"
2023-05-05 08:06:58: models/Setting: "Saving settings..."
2023-05-05 08:06:58: models/Setting: "Settings have been saved."
2023-05-05 08:10:26: RevisionService: "maintenance: Starting..."
2023-05-05 08:10:26: RevisionService: "maintenance: Service is enabled"
2023-05-05 08:10:26: RevisionService: "collectRevisions: Created revisions for 0 notes"
2023-05-05 08:10:26: RevisionService: "maintenance: Done in 111ms"

after that, the log just has this in the log when it tries to sync

2023-05-08 10:12:12: "Running background sync on timer..."
2023-05-08 10:12:12: "Scheduling sync operation...", "0"
2023-05-08 10:12:12: "Preparing scheduled sync"
2023-05-08 10:12:12: "Starting scheduled sync"
2023-05-08 10:12:12: "Synchronisation is already in progress. State: in_progress"
2023-05-08 10:12:12: "Setting up recurrent sync with interval 300"

Environment

Joplin version: 2.9.17 Platform: windows OS specifics: windows 10

Joplin 2.9.17 (prod, win32)

Client ID: 339fa57187c64b44a9fa462e73aca41c
Sync Version: 3
Profile Version: 41
Keychain Supported: Yes

Revision: a84a8e7

Steps to reproduce

  1. Leave joplin running for a while
  2. Sync fails and it just shows "Cancelling..."
  3. have to restart joplin for syncs to resume

Describe what you expected to happen

Syncs to resume normally even after a 1 time error

Logfile

I have a log file however it seems to contain the contents of my notes, let me know if you are looking for something specific and I can attach it

mgrandi avatar Jul 19 '23 22:07 mgrandi

and to be clear this is still happening on

Joplin 2.11.11 (prod, win32)

Client ID: 339fa57187c64b44a9fa462e73aca41c Sync Version: 3 Profile Version: 43 Keychain Supported: Yes

Revision: 6886f6f

Simple Backup: 1.1.1 Templates: 2.3.0

mgrandi avatar Jul 19 '23 22:07 mgrandi

Files in the locks folder try to prevent multiple clients from doing incompatible sync operations at the same time. For example, when my copy of Joplin starts syncing, it:

  1. Creates \Apps\Joplin\locks\1_1_somelongclientidhere.json.
  2. Syncs
  3. Removes \Apps\Joplin\locks\1_1_somelongclientidhere.json.

If I force-quit Joplin while it's syncing (e.g. with Task Manager), \Apps\Joplin\locks\1_1_somelongclientidhere.json isn't deleted and other clients aren't able to sync.

On my computer, however, \Apps\Joplin\locks\1_1_somelongclientidhere.json is deleted automatically after I open Joplin (the Joplin client that I force-quit) again and sync. From the description above, it sounds like Joplin isn't crashing, however. Thus, Joplin may be failing to remove the lock file when it finishes syncing.

From the log you provided, it looks like Joplin tries to do this and fails (unlink means delete):

2023-05-05 08:06:58: "Error: Error: EBUSY: resource busy or locked, unlink 'C:\Users\mgrandi\OneDrive - Microsoft\JoplinSync\locks\1_1_339fa57187c64b44a9fa462e73aca41c.json'. Path: C:\Users\mgrandi\OneDrive - Microsoft\JoplinSync/locks/1_1_339fa57187c64b44a9fa462e73aca41c.json
Code: EBUSY

Edit: My guess is that OneDrive locks files while they're being uploaded. Thus, if Joplin finishes syncing, while the lock file is being uploaded, the deletion of the lock file may fail.

As such, if you're sure that no client is currently syncing, one temporary solution would be to open OneDrive and manually delete the file from the locks folder.

restarting Joplin fixes the issue, but I (most of the time) only have one client syncing , it seems that OneDrive is locking the file occasionally for some reason, and joplin is expecting to delete the file (that it created to lock the profile folder for syncing), and when it is unable to do so it just breaks and gets into a bad state where it can't sync and can't cancel either, and syncing stops until you restart the app

mgrandi avatar Jul 19 '23 23:07 mgrandi

still happens in

Joplin 2.12.10 (prod, win32)

Client ID: 339fa57187c64b44a9fa462e73aca41c
Sync Version: 3
Profile Version: 43
Keychain Supported: Yes

Revision: 40b89f6

Simple Backup: 1.1.1
Templates: 2.3.0

i cant find it in the log since log.txt seems to be not being written anymore even with --open-dev-tools --debug --log-level debug in flags.txt

mgrandi avatar Aug 01 '23 22:08 mgrandi

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? If you require support or are requesting an enhancement or feature then please create a topic on the Joplin forum. This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

github-actions[bot] avatar Sep 01 '23 16:09 github-actions[bot]

Nope, still happens

On Fri, Sep 1, 2023, 09:02 github-actions[bot] @.***> wrote:

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? If you require support or are requesting an enhancement or feature then please create a topic on the Joplin forum https://discourse.joplinapp.org/. This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

— Reply to this email directly, view it on GitHub https://github.com/laurent22/joplin/issues/8512#issuecomment-1702977685 or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGD7YRNQYWR2CURONI3VETXYIBKJBFKMF2HI4TJMJ2XIZLTSWBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDUOJ2WLJDOMFWWLLTXMF2GG2C7MFRXI2LWNF2HTAVFOZQWY5LFUVUXG43VMWSG4YLNMWVXI2DSMVQWIX3UPFYGLAVFOZQWY5LFVE2TCOJXGAYDONBRURXGC3LFVFUGC427NRQWEZLMQKSXMYLMOVS2UMJUGU4TQMBYGQYDPJDOMFWWLKLIMFZV63DBMJSWZLDTOVRGUZLDORPXI6LQMWWES43TOVSUG33NNVSW45FGORXXA2LDOOKIFJDUPFYGLKTSMVYG643JORXXE6NFOZQWY5LFVA3TSMJWGI3DQMUCUR2HS4DFUVUXG43VMWSXMYLMOVS2UMJYGEZDOOJXGEZTFAVEOR4XAZNFNRQWEZLMUV3GC3DVMWUTKMJZG4YDANZUGGBKI5DZOBS2K3DBMJSWZJLWMFWHKZNKGE2DKOJYGA4DIMBXU52HE2LHM5SXFJTDOJSWC5DF . You are receiving this email because you authored the thread.

Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub .

mgrandi avatar Sep 01 '23 16:09 mgrandi

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? If you require support or are requesting an enhancement or feature then please create a topic on the Joplin forum. This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

github-actions[bot] avatar Oct 02 '23 16:10 github-actions[bot]

Pretty sure it's not fixed

mgrandi avatar Oct 02 '23 16:10 mgrandi

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? If you require support or are requesting an enhancement or feature then please create a topic on the Joplin forum. This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

github-actions[bot] avatar Nov 02 '23 16:11 github-actions[bot]

still not fixed.

mgrandi avatar Nov 02 '23 16:11 mgrandi

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? If you require support or are requesting an enhancement or feature then please create a topic on the Joplin forum. This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

github-actions[bot] avatar Dec 03 '23 16:12 github-actions[bot]

Nope, still here

mgrandi avatar Dec 03 '23 18:12 mgrandi

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? If you require support or are requesting an enhancement or feature then please create a topic on the Joplin forum. This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

github-actions[bot] avatar Jan 03 '24 16:01 github-actions[bot]

This isn't fixed as far as I'm aware

mgrandi avatar Jan 03 '24 23:01 mgrandi

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? If you require support or are requesting an enhancement or feature then please create a topic on the Joplin forum. This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

github-actions[bot] avatar Feb 03 '24 16:02 github-actions[bot]

Just happened yesterday as a matter of fact

mgrandi avatar Feb 03 '24 18:02 mgrandi

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? If you require support or are requesting an enhancement or feature then please create a topic on the Joplin forum. This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

github-actions[bot] avatar Mar 05 '24 16:03 github-actions[bot]

Nope not stale

mgrandi avatar Mar 06 '24 17:03 mgrandi

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? If you require support or are requesting an enhancement or feature then please create a topic on the Joplin forum. This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

github-actions[bot] avatar Apr 07 '24 16:04 github-actions[bot]

still not fixed

mgrandi avatar Apr 07 '24 23:04 mgrandi

still happening

mgrandi avatar Apr 08 '24 00:04 mgrandi