laurent22 / joplin

Joplin - the secure note taking and to-do app with synchronisation capabilities for Windows, macOS, Linux, Android and iOS.
https://joplinapp.org
Other
44.44k stars 4.8k forks source link

Android sync gets permanently stuck whilst seemingly doing nothing #8402

Open robme opened 1 year ago

robme commented 1 year ago

I'm splitting this from #8123 since it is a different issue.

This is a long-term issue going on for years described elsewhere on the internet e.g.

Environment

Joplin version: 2.11.31 Platform: Android 13 OS specifics: using Dropbox as sync mechanism, encryption enabled

Steps to reproduce

This happens randomly, so I don't know the exact cause.

  1. Open Android app.
  2. Use biometrics (fingerprint) to unlock.
  3. Joplin immediately begins a sync.
  4. Joplin stays syncing forever without showing anything other than the spinner animation.
  5. If you press 'Cancel' then it shows 'Cancelling...' forever.
  6. Force close the app.
  7. Open the app again and use fingerprint to unlock.
  8. Problem repeats from step 3.

It will continue like this forever. The only way to resolve it is to force it to get locked out by repeatedly force closing the app and opening it whilst also syncing on another device. This isn't always easy because if there is nothing to sync on desktop then it's very quick, so you have to get the timing just right to cause it to lock. After being locked out, it will regain the ability to sync.

Describe what you expected to happen

It should always be able to sync. The app is essentially unusable when this happens almost every day. I don't always have the ability to get to a computer to do the fix.

Logfile

Screenshot_20230630-194313

Screenshot_20230630-194412

kalvn commented 1 year ago

Same here, except it never worked.

joao-alemao commented 1 year ago

I am also experiencing this issue for a while now and was looking for solutions. The syncing on the mobile app gets stuck indefinitely up until an error "Cannot acquire exclusive lock because the following clients have a sync lock on the target" appears. Do not know why this happens as no other device is syncing.

My sync target is Dropbox. This only happens on the android app.

joplin_log

github-actions[bot] commented 11 months ago

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.

joao-alemao commented 11 months ago

Update: the issue is still present, fix seems to be going on desktop app and manually triggering sync, syncing on android app then works.

robme commented 11 months ago

This is so frustrating. It seems like it's not even syncing, it just gets stuck doing nothing, but saying it's syncing. From checking the log, it doesn't appear to be trying to sync.

The only way to make it realise that it isn't syncing is to force the lock to happen, as described before.

One thing I've noticed is sometimes after a successful sync it will immediately say "Syncing" again, could be related?

npike commented 10 months ago

Same issue on Android 13 syncing to dropbox...

github-actions[bot] commented 9 months ago

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.

robme commented 9 months ago

Still a problem.

github-actions[bot] commented 8 months ago

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.

robme commented 8 months ago

No it hasn't magically fixed itself.

e3roll commented 8 months ago

Hi, please prioritize this bug. This is happening on my Android device for almost a year. There's no error on the logs. Also, this is happening with no lock (biometrics). The only way was to do the workaround in this comment. But now that workaround does not even work. I do the following:

  1. Disconnect wifi and mobile data on mobile.
  2. Start mobile app.
  3. Sync mobile.
  4. Wait until it says it has finished.
  5. Connect wifi or mobile data.
  6. Open desktop app.
  7. Now add a change on a note on desktop app.
  8. Sync desktop and sync mobile at the same time.
  9. Sync error on mobile is shown.
  10. Sync again on mobile.

This is very frustrating and it happens every time you try to sync. Before it was once in while.

Mobile:

Desktop:

Server: dropbox

opqriu commented 7 months ago

Don't connect Dropbox directly from Joplin Android. In my experience... Using an app like Dropsync will solve this problem.

https://discourse.joplinapp.org/t/i-solved-android-stopped-syncing/33988?u=ranicloudy

graphit0 commented 7 months ago

Trying to trace down how to reproduce the behaviour here. I have a suspicion that the behaviour is caused by syncing mobile client with unresolved conflicts. Can anyone confirm or deny?

robme commented 7 months ago

I think it happens to me regardless of if there are conflicts.

github-actions[bot] commented 6 months ago

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.

kenden commented 6 months ago

This is still an issue. I still have to do often the workaround from https://www.reddit.com/r/joplinapp/comments/p9pqsh/comment/j5yqje8/

  1. Make sure android app is trying to sync.
  2. On laptop make sure there is something to sync. Then make any change add space etc.
  3. Start sync on the laptop.
    This will result in error on Android something like: 'other device is syncing/cannot get exclusive lock's Now android is in normal non-syncing state.
  4. Start syncing again on Android. Syncing should start working again.
npike commented 6 months ago

Same situation here sadly.

personalizedrefrigerator commented 6 months ago

If the error mentions a sync lock, this is another possible workaround (originally written for OneDrive, but should also apply to Dropbox):

**Posted by @personalizedrefrigerator:** This can happen if one Joplin client is still syncing (or was closed during a sync). Re-opening and re-syncing the client that was interrupted may fix the issue. If this was caused by a Joplin client that no longer exists (e.g. was uninstalled), you can try the following: 1. Make a backup 2. Delete files from `Apps/Joplin/locks` on OneDrive https://discord.com/channels/610762468960239627/610762468960239629/1184518156123906209

Additionally:

**Posted by @laurent22**: To add up to this, the locks expire so if you wait a few minutes it should start working again https://discord.com/channels/610762468960239627/610762468960239629/1184530213045014558

But from the comments above, the issue doesn't seem to resolve after a few minutes... If deleting the lock file helps, there may be a bug in lock file expiration.

graphit0 commented 6 months ago

@personalizedrefrigerator thank you. This workaround just worked for me.

The issue does seem to have something to do with lock expiration since behaviour persists seemingly indefinitely

Any tip how can one track down the process for lock to fail to expire?

I have a feeling (based on what people stated in the past related to the issue) it happens during the desktop update on new version (from 2.12 to 2.13, from 2.13 to 2.14 etc) but mobile app stays on previous version. I'll try testing this hypothesis with various parameters but at this point I'm as good as blind guessing.


Upd this hypothesis was wrong

fellipec commented 5 months ago

I just got in the same situation, phone stopped sync couple of days ago.

There is no error message, just stuck in syncing or cancelling if you try.

Resolved by deleting the files locks directory.

robme commented 4 months ago

I have now had it happen in the Desktop app (Windows)! It just appeared to be syncing forever, and couldn't be cancelled. Then I remembered this bug, and the same fix worked but in reverse. I opened the Android app and told it to sync, then the desktop app got locked out of sync, and then it was able to sync afterwards.

joao-alemao commented 4 months ago

@laurent22 seems like this could be a candidate for a deeper look? Seems that the lock simply isn't released or that the behavior to nuke the /locks files could be defaulted to? I don't mind taking a look but would need some pointers on where to turn my attention to, to be able to identify the root cause.

roman-r-m commented 4 months ago

I don't mind taking a look but would need some pointers on where to turn my attention to, to be able to identify the root cause.

Perhaps here: https://github.com/laurent22/joplin/blob/dev/packages/lib/services/synchronizer/LockHandler.ts#L136

slimygorilla72 commented 4 months ago

I feel like this post (that I made) may have some useful info: https://discourse.joplinapp.org/t/i-solved-android-stopped-syncing-dropbox/33988/8?u=giantchain67

In short, there may be stale files in joplin's sync location (in my case dropbox) In this directory: Apps\Joplin\Locks These may need to be cleared out, the android client is not happy with them (perhaps gets in an unhandled loop / error state)

RyanChimienti commented 2 months ago

I have now had it happen in the Desktop app (Windows)! It just appeared to be syncing forever, and couldn't be cancelled. Then I remembered this bug, and the same fix worked but in reverse. I opened the Android app and told it to sync, then the desktop app got locked out of sync, and then it was able to sync afterwards.

@robme same issue here. I'm using Windows + Android + Dropbox, and the sync was hanging on Windows. The "reverse" fix did the trick for me--thanks!

Zesko commented 1 month ago

I have experienced the problem with Dropbox and Joplin Android encryption.

Out of curiosity, is OneDrive also affected?