Home / GitHub Page

The sync target needs to be upgraded before Joplin can sync

Hello

I'm using Joplin 1.2.6. (latest at this time) on Windows 10.
I'm syncing my notes using a nextcloud instance.

I'm experiencing a weird issue, that seems to come back very regularly.
I get a orange bar at the top of the window with the following text:

The sync target needs to be upgraded before Joplin can sync. The operation may take a few minutes to complete and the app needs to be restarted. To proceed please click on the link. Restart and upgrade

I click on 'Restart and upgrade' and then the application will restart and will give a white windows with the following text:
Joplin upgrade in progress...
Please wait while the sync target is being upgraded. It may take a few seconds or a few minutes depending on the upgrade. The application will automatically restart once it is completed.

Sometimes I get an error on this step (I tried again when typing this topic, but no error appeared then, so I can't paste it), sometimes I don't get an error. I can't seem to find the issue.
At first I thought it was an issue with using sync on multilple devices (android, ios and another windows 10 pc), but I've uninstalled Joplin on every device except 1, but the message will keep reappearing after a while, several times a day. Sometimes even directly when the upgrade has completed.

I found this topic, but it states that the bug should be fixed in 1.0.242, but that was a while ago.

I would love to reinstall joplin on my other devices so I can read my notes there.
Do other people have the same issue? What can I do to fix this?

I just got it again, and now the error appeared:

Error
The sync target could not be upgraded due to an error. For support, please copy the complete content of this page and paste it in the forum: https://discourse.joplinapp.org/

The full error was:

    Cannot acquire exclusive lock because the following clients have a sync lock on the target: (desktop #5cc8cb0851954f629d8075d3acead4ba)

    Error: Cannot acquire exclusive lock because the following clients have a sync lock on the target: (desktop #5cc8cb0851954f629d8075d3acead4ba)
        at LockHandler.<anonymous> (C:\Program Files\Joplin\resources\app.asar\lib\services\synchronizer\LockHandler.js:221:31)
        at Generator.next (<anonymous>)
        at fulfilled (C:\Program Files\Joplin\resources\app.asar\lib\services\synchronizer\LockHandler.js:5:58)

Just to let you know, I just received the same message again, also with the same error
Joplin upgrade in progress...
Please wait while the sync target is being upgraded. It may take a few seconds or a few minutes depending on the upgrade. The application will automatically restart once it is completed.

Error
The sync target could not be upgraded due to an error. For support, please copy the complete content of this page and paste it in the forum: https://discourse.joplinapp.org/

The full error was:

Cannot acquire exclusive lock because the following clients have a sync lock on the target: (desktop #5cc8cb0851954f629d8075d3acead4ba)

Error: Cannot acquire exclusive lock because the following clients have a sync lock on the target: (desktop #5cc8cb0851954f629d8075d3acead4ba)
    at LockHandler.<anonymous> (C:\Program Files\Joplin\resources\app.asar\lib\services\synchronizer\LockHandler.js:221:31)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Program Files\Joplin\resources\app.asar\lib\services\synchronizer\LockHandler.js:5:58)

What does it say in the About dialog?

I used the copy function in the about dialog:

Joplin for Desktop

Copyright © 2016-2020 Laurent Cozic
Joplin 1.2.6 (prod, win32)

Client ID: 5cc8cb0851954f629d8075d3acead4ba
Sync Version: 2
Profile Version: 34
Keychain Supported: Yes

Revision: f5f117cb (master)

Also the log please https://joplinapp.org/debugging It's strange because it seems the client tries to sync when it shouldn't and ends up locking itself out of the upgrade.

See logfiles:
log-anonymized1.txt (3.2 MB)
log-anonymized2.txt (3.2 MB)
log-anonymized3.txt (2.4 MB)

I've removed my name and URL for privacy reasons (I've replaced them with NAME and URL)

I've enabled the flags.txt file and restarted the application, I will upload that log once the issue occurs again.

But isn't the issue 2 fold?
Namely:

  1. Why is that upgrade message appearing so often?
  2. Why is the upgrade message failing only sometimes? I would expect that if it completes successfully once, the upgrade message would dissappear until an update of the application requires another upgrade.

In the log I see that the recent upgrade process was successful so does it work now?

Then the question is why it tries to do it again later. Normally it would only do so if the structure of the sync target is somehow changed. Just to be sure, could you go on Nextcloud, then see if there's an info.json file in the Joplin sync folder? Then make note of its content (should be {"version":2}).

If the app asks you to upgrade again, please do the following:

  • Make a copy of the log right away (to ensure what's at the bottom is what has just happened)
  • Check on Nextcloud again if info.json is present and what is its content.
  • And please post the info here.

I haven't had the message again since the last time it popped up, about an hour and a half ago.
I've checked the info.json file and this file exists with the following content:

{"version":2}

The last change date of this file was "about an hour ago", so it seems that Joplin has updated this file, though I'm not sure if it always did this.

I'll keep the steps you posted in my mind when the message appears again.
Do you want me to execute those steps before or after I click on the "restart and upgrade" button?

Before you click on the button, because by that point the bug has happened already and the log might show some info about it.

It was going good today, I was hoping that the issue would resolve itself, but it happened again. So here I am again

The info.json file is present on Nextcloud with the following content:

{"version":2}

Here is the log (continuing from my previous log upload): log-anonymized4.txt (199.5 KB)

I do have to add, I had my desktop pc running this time (which is a different computer than the one where these logs come from), which also has Joplin installed and running. Not sure if this matters, just wanted to let you know in case it does

I had a look at the log and it's like the file info.json is there, but it's not there on your sync target. The relevant lines are there:

2020-10-16 16:40:20: "get info.json"
2020-10-16 16:40:20: "get .sync/version.txt"
2020-10-16 16:40:23: "Sync version of the target (1) is lower than the version supported by the client (2). Please upgrade the sync target."

It tries to find info.json but doesn't find it, so it tries to get the legacy version.txt, which it finds and so it assumes the sync target version is "1". Later in the log, it finds info.json without a problem:

2020-10-16 16:45:24: "get info.json"
2020-10-16 16:45:25: "Sync target info:", "{"version":2}"

In theory it's not possible, either the file is there and it works or it's not but in your case it's random.

The only way it could happen is if your setup somehow lies about error code - like it would return "not found" when there's some connection or database error (which Joplin would handle fine).

What does it say on the Nextcloud log for the GET info.json request at "2020-10-16 16:40:20"?

In fact is there anything in the Nextcloud log related to info.json being deleted? (normally it would not be deleted by the app)

I don't seem to be able to access the Nextcloud logs, I don't host that instance myself. I use a service for that.

Now I do have to say, when looking for the info.json file, I did notice that the connection is very slow sometimes, yesterday it was slow, today it is better. I only use that Nextcloud instance for Joplin, so I didn't notice it before. Sometimes its even so slow that the webpage loads only halfway (banner loads but it doesn't display the files).
Could that be a/the reason why Joplin couldn't find the info.json file? Because Nextcloud is too slow or unable to respond to that request from Joplin? Or is that handled some other way inside Joplin?

Yes and no. If the connection is slow or if there's any network error, the sync process will first retry, then eventually fail but it won't ask you to upgrade.

What's happening is only possible if the server response code is lying and is sending a "Not found" (404) error when the connection fails or the server is too slow.

If you are able to create a test user on that server, I can give it a try and see if I can replicate and fix the issue (in which case, please send the credentials via PM).

Apparently I'm only limited to 1 user on my Nextcloud instance, so I can't create a test user.
Is there a way to have more logging on Joplin side? To log what Joplin receives from Nextcloud? To check is there is a 404 error coming from Nextcloud if the issue occures?

No it's not possible as of now.

I'm not really sure what we can do to further troubleshoot this issue?

I do have the feeling that the issue lays with a Nextcloud issue, like you said, that it gives a 404 error when Nextcloud is slow or having other issues.

The instance is fast now, and the notification hasn't appeared in Joplin.

Unfortunately, without visibility on the Nextcloud logs there's not much to do. What we'd see on Joplin side is a Not Found (404) error. But the question is why the file is not found when it should be there, and logs might answer that.

For example, at some point Nextcloud had a database bug and would report an empty directory instead of reporting an error. So Nextcloud doesn't always report errors properly, and clients can't do anything when the server lies about what's happening.

I think you are correct in your assessement.

I just got the Joplin notification again and I quickly logged into the Nextcloud instance.
The instance is unreasonably slow. I will be on the lookout for a different provider :slight_smile:

I do want to thank you @laurent, for your assistance. I already liked using Joplin, but the support I received was even better than most other application. Thanks! I'll continue using and supporting Joplin. Keep it up!

Its been a week almost and I have changed from Nextcloud provider to another one.
The issue hasn't come up again. So it did seem that the slow nextcloud instance was the issue.

1 Like