GothenburgBitFactory / taskwarrior

Taskwarrior - Command line Task Management
https://taskwarrior.org
MIT License
4.5k stars 311 forks source link

Task 3.0: Failed to synchronize with server #3695

Closed trev-dev closed 4 days ago

trev-dev commented 1 week ago

To report a bug...

I have a local file that I sync to then share with my work machine and phone via Syncthing. It's been working fine but now my personal machine is saying: Failed to synchronize with server.

Normally the syncing works fine. I have no idea where to start with this one.

task 3.0.2
   Platform: Linux

Compiler
    Version: 13.2.0
       Caps: +stdc +stdc_hosted +LP64 +c8 +i32 +l64 +vp64 +time_t64
 Compliance: C++17

Build Features
      CMake: 3.29.2
    libuuid: libuuid + uuid_unparse_lower
 Build type: Release

Configuration
       File: /home/trev/.taskrc (found), 1944 bytes, mode 100644
       Data: /home/trev/.task (found), dir, mode 40755
    Locking: Enabled
         GC: Enabled
    $EDITOR: nvim
Hooks
     System: Enabled
   Location: /home/trev/.task/hooks
     Active: on-modify.timewarrior (executable)
   Inactive:

Tests
   Terminal: 137x60
       Dups: Scanned 724 tasks for duplicate UUIDs:
             No duplicates found
 Broken ref: Scanned 724 tasks for broken references:
             No broken references found
djmitche commented 1 week ago

Can you show the command you are running and the error?

ryneeverett commented 1 week ago

Which file(s) are synced with syncthing? All of /home/trev/?

trev-dev commented 1 week ago

Can you show the command you are running and the error?

Just task sync

Which file(s) are synced with syncthing? All of /home/trev/?

The setting in my .taskrc is sync.local.server_dir=/home/trev/Sync, where an sqlite database taskchampion-local-sync-server.sqlite3 is generated. All of /home/trev/Sync is syncronized by syncthing.

djmitche commented 5 days ago

Hm, what does syncthing do if the server DB is modified on both the phone and desktop? I imagine that's what's happened, and I can't see any way that it could deal with that properly, since it doesn't know the details of the server's database schema. I think if you will need to choose either Syncthing or taskwarrior sync, but not both.

ryneeverett commented 4 days ago

I think @djmitche has this right, but I want to elaborate in order to increase our mutual understanding of this issue. Please correct me if I'm wrong.

I believe your system could work if you could guarantee that any time you ran task sync, the given device on which you ran it had the latest version of the local sync database propagated by syncthing. (There probably is no practical way to guarantee this though, which is why this is inadvisable.) Thinking about this in terms of the sync model, this should work because when a different device modifies the database and you run task sync, it performs operational transformation to rebase the device's new operations on the updated local sync database.

The problem was likely that a sync conflict occurred, which overwrote the local sync server database and clobbered the base version your local replica expected. So next time you ran task sync, there was essentially a merge conflict with the local sync database, because the operations you were trying to sync from your local replica were based on a parent version which no longer existed in the local sync database.

You should be able to confirm this theory by finding a taskchampion-local-sync-server.sync-conflict-<date>-<time>-<modifiedBy>.sqlite3 file.

trev-dev commented 4 days ago

I see, well, I thought using a "remote" in this manner would work. Apparently I've misunderstood how syncing works with the local file system. There was a "conflict" database, which I removed. It did not help things.

I guess I need to go through the motions of figuring out how to get a real task server going again with taskchampion.