orgzly / orgzly-android

Outliner for taking notes and managing to-do lists
https://www.orgzly.com
GNU General Public License v3.0
2.68k stars 305 forks source link

Rescheduling an event from notification produces a sync error #415

Open vit1-irk opened 5 years ago

vit1-irk commented 5 years ago

I'm submitting a bug report for version 1.6.10 This bug exists not only in 1.6.10, but also in all previous versions of Orgzly. I'm submitting an issue because this thing has got really annoying.

Steps to reproduce:

  1. Auto-sync to the local filesystem is turned on, notifications are turned on
  2. There is an event recurring every week
  3. Wait for the time of next recurring of your event, system notification appears.
  4. Press "reschedule to +1week" button from your system notification.
  5. Another system notification appears saying like "there are merge conflicts, local and remote notebooks differ"

Steps to come over that nasty error:

  1. Wait for notification of your event, do NOT press any buttons!
  2. Open Orgzly
  3. Reschedule an event any way you like
  4. Maybe there won't be sync errors
nevenz commented 5 years ago

Are you syncing some other source with that same directory? Could it be that it's a valid conflict - file modified both in Orgzly and elsewhere before syncing?

There shouldn't be anything different going on when shifting time from notification.

vit1-irk commented 5 years ago

It does communicate with my Nextcloud instance from time to time.

Probably like that:

  1. Orgzly thinks the "remote" file is unmodified and shifts the local time
  2. Orgzly tries to synchronize two files after modification
  3. It fails because the sync algorithm is simple and it can't auto-merge like Git does

Possible solution (when pressing button):

  1. Orgzly synchronizes two files to prevent conflicts that MAY happen
  2. If original note inside the notebook is absent, the notification closes without reschedule
  3. If original note is still present, Orgzly shifts time in local file 3.1. Orgzly syncs the second time to push changes back as it does now
vit1-irk commented 5 years ago

Hmm, doesn't look like it's my own sync tool, because today I was syncing notebooks in manual mode, and the error was still produced.

I'll try to catch logcat output if possible

nevenz commented 5 years ago

I was syncing notebooks in manual mode

What do you mean by this?

Do you normally use Nextcloud's Android app for syncing, marking files as "available offline"? I've just started using it and I'm getting some strange modification times set for each file. It seems it's set to the time file was previously synced.

It's doesn't really matter what it is though, it's important that it changes, as it's used as "revision" by Orgzly.[1] But perhaps it doesn't change in some cases.

[1] This needs to be improved, which was attempted in the past.

I'll try to catch logcat output if possible

I'm not sure it's verbose enough, especially in production version. I'll see to change that.

vit1-irk commented 5 years ago

Do you normally use Nextcloud's Android app for syncing, marking files as "available offline"?

No, totally not. I use my own script which runs SSH scp utility to pull & push files to server and back for Orgzly

What do you mean by this?

I was mistaken.

Earlier I had to manually launch Orgzly after downloading of newer version of notebook to sync the changes.

Now my download script contains this line am startservice -a com.orgzly.intent.action.SYNC_START com.orgzly/com.orgzly.android.sync.SyncService

But sync errors are not completely gone

vit1-irk commented 5 years ago

Got several conflicts today, catched some logcat output, but without sensible result

Tried to export "local" and "remote" notebooks to find out what is the real problem

diff "remote file" "local file"

screenshot_20181130-230309

Looks like the problem is on my own side, because the changes were not synced immediately after edit

@nevenz

  1. Is there a method to trigger a custom intent when Orgzly completes filesystem synchronization? It will be a perfect way to push changes back to the server. Good to combine it with Termux
  2. Maybe Orgzly needs to implement detailed conflicts view screen to resolve sync issues easily (and figure out what happened)?
nevenz commented 5 years ago

Is there a method to trigger a custom intent when Orgzly completes filesystem synchronization? It will be a perfect way to push changes back to the server. Good to combine it with Termux

It could be implemented.

Maybe Orgzly needs to implement detailed conflicts view screen to resolve sync issues easily (and figure out what happened)?

Something to help with resolving conflicts is planned. There has been some discussion in #8.

38 or #33 will solve these kind of issues.

Thanks for debugging this. I've been seeing similar issues since trying Nextcloud app. Perhaps something like FolderSync using WebDAV might be a better solution.

vit1-irk commented 5 years ago

Ok, sorry for bothering and waiting for some changes

Let this issue be opened for some time