silverbullet: Unexpected page conflict while editing page

TL;DR: Getting unexpected page conflict when editing page, with partial data loss.

Updates

Original issue was opened for Deno Deploy + Garage (S3 clone) setup. Which has been resolved(avoided) by running Deno directly on a server and use local disk for storage.

Similar issue seems to happen with different setup, see comments down below.

Issue description

While editing a page, app would suddenly detect file changed elsewhere then reloads or page conflicted which creates a conflict page.

There’s only 1 user from 1 browser tab.

Expected

No conflict or page change since there’s only 1 user.

Env info

  • SB version: 0.3.5
  • SB deployed on Deno Deploy
  • SB storage using self-hosted Garage instance (S3 compatible)
  • Browser: Firefox, Arc
  • OS: MacOS 13.1

Screenshots

image

Logs

Server logs also available but less interesting than the browser one.

Partial browser output
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on both ends, potential conflict meta/arch.md
[sync] Starting conflict resolution for meta/arch.md
[sync] File is markdown, using smart conflict resolution
[sync] Going to create conflicting copy meta/arch.conflicted.1689867793000.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
[sync] Fetching snapshot from primary
[sync] Fetching snapshot from secondary
[sync] File has changed on secondary, but not primary: copy from secondary to primary meta/arch.md
[sync] File has changed on secondary, but not primary: copy from secondary to primary meta/arch.conflicted.1689867793000.md
[sync] Sync complete, operations performed 2
Page changed elsewhere, reloading
Reloading page
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on both ends, potential conflict meta/arch.md
[sync] Starting conflict resolution for meta/arch.md
[sync] File is markdown, using smart conflict resolution
[sync] Going to create conflicting copy meta/arch.conflicted.1689867952000.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
[sync] Fetching snapshot from primary
[sync] Fetching snapshot from secondary
[sync] File has changed on secondary, but not primary: copy from secondary to primary meta/arch.md
[sync] File has changed on secondary, but not primary: copy from secondary to primary meta/arch.conflicted.1689867952000.md
[sync] Sync complete, operations performed 2
Page changed elsewhere, reloading
Reloading page
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on both ends, potential conflict meta/arch.md
[sync] Starting conflict resolution for meta/arch.md
[sync] File is markdown, using smart conflict resolution
[sync] Going to create conflicting copy meta/arch.conflicted.1689868015000.md
[sync] Fetching snapshot from primary
[sync] Fetching snapshot from secondary
[sync] File has changed on secondary, but not primary: copy from secondary to primary meta/arch.md
[sync] File has changed on secondary, but not primary: copy from secondary to primary meta/arch.conflicted.1689868015000.md
[sync] Sync complete, operations performed 2
Page changed elsewhere, reloading
Reloading page
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on both ends, potential conflict meta/arch.md
[sync] Starting conflict resolution for meta/arch.md
[sync] File is markdown, using smart conflict resolution
[sync] Going to create conflicting copy meta/arch.conflicted.1689868039000.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
[sync] Fetching snapshot from primary
[sync] Fetching snapshot from secondary
[sync] File has changed on secondary, but not primary: copy from secondary to primary meta/arch.md
[sync] File has changed on secondary, but not primary: copy from secondary to primary meta/arch.conflicted.1689868039000.md
[sync] Sync complete, operations performed 2
Page changed elsewhere, reloading
Reloading page
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on both ends, potential conflict meta/arch.md
[sync] Starting conflict resolution for meta/arch.md
[sync] File is markdown, using smart conflict resolution
[sync] Going to create conflicting copy meta/arch.conflicted.1689868055000.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
Saving page meta/arch
Syncing file meta/arch.md
[sync] File changed on primary, copying to secondary meta/arch.md
mini_editor.tsx:70 Creating editor view
[sync] Fetching snapshot from primary
[sync] Fetching snapshot from secondary
[sync] File has changed on secondary, but not primary: copy from secondary to primary meta/arch.md
[sync] File has changed on secondary, but not primary: copy from secondary to primary meta/arch.conflicted.1689868055000.md
[sync] Sync complete, operations performed 2
Page changed elsewhere, reloading
Reloading page

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 21 (2 by maintainers)

Commits related to this issue

Most upvoted comments

Ok, I have implemented various attempts at fixes for this and I’m fairly hopeful that what I have now should be ok. If you could try a current edge build and see if this happens? https://community.silverbullet.md/t/living-on-the-edge-builds/27

Ok, I have implemented various attempts at fixes for this and I’m fairly hopeful that what I have now should be ok. If you could try a current edge build and see if this happens? https://community.silverbullet.md/t/living-on-the-edge-builds/27

I just spent the last 15 minutes typing and adding everything I could think of (templates, code blocks, tasks, etc.) …and absolutely no issues!! 🥳 I also kept a second tab open and watched that tab correctly reload itself whenever I made changes in the other.

This is amazing! I can’t speak for everyone else in this thread, but I think all of my issues have been resolved 😊 Thank you so much for your hard work, Zef!

Ok, I have implemented various attempts at fixes for this and I’m fairly hopeful that what I have now should be ok.

I’ve been following this thread because I’ve been having this problem myself. Anecdotally the latest edge build is significantly better. This was happening very consistently and regularly for me, and now I’m not able to trigger the issue at all. So whatever you did seems to have worked for me. Thank you!!

Ok, I just added another safeguard, hopefully this one will help. I’m now preventing a sync to kick when while a page is saving. Hopefully this is the race condition that caused this issue 🤞🏻

Unfortunately, this did not fix the issue for me 😔 I’ve been getting the “Page changed elsewhere, reloading” error pretty frequently/consistently when typing, and switching to the edge version did not solve the issue nor reduce its frequency. I’ve included as much info as I could below:

My setup
  • Client - Firefox on Windows 10, on the same local network as the server, connecting directly to port 3000 (no reverse proxy)
  • Server - Standard docker compose install (except with the edge tag) on Debian
  • Plugs - treeview, mermaid
SETTINGS.md
indexPage: Home

hideSyncButton: true

actionButtons:
- icon: home # Use any icon from https://feathericons.com
  command: "{[Navigate: Home]}"
  description: "Go to the index page"
- icon: sidebar
  command: "{[Tree View: Toggle]}"
  description: "Toggle Tree View"
- icon: book
  command: "{[Navigate: Page Picker]}"
  description: Open page
- icon: terminal
  command: "{[Open Command Palette]}"
  description: Run command
- icon: arrow-left
  command: "{[Navigate: Back in History]}"
  description: "Go to the previous page"
  mobile: true # Only show on mobile devices, set to false to show only on desktop

shortcuts:
  - command: "Page: Extract"
    key: "Ctrl+Alt+E"

treeview:
  size: 0.5
PLUGS.md
- github:silverbulletmd/silverbullet-mermaid/mermaid.plug.js
- github:joekrill/silverbullet-treeview/treeview.plug.js
Full Firefox console logs
Booting SilverBullet client in Online Mode boot.ts:8:10
Not launching service worker, likely because not running from localhost or over HTTPs. This means SilverBullet will not be available offline. boot.ts:43:10
Rebuilding editor state client.ts:825:32
Loading plugs client_system.ts:210:16
(Re)loading plugs client_system.ts:213:16
Booting up worker for emoji bundle.ts:50:12
Booting up worker for tasks bundle.ts:50:12
Booting up worker for federation bundle.ts:50:12
Booting up worker for index bundle.ts:50:12
Booting up worker for query bundle.ts:50:12
Booting up worker for share bundle.ts:50:12
Booting up worker for search bundle.ts:50:12
Booting up worker for sync bundle.ts:50:12
Booting up worker for plug-manager bundle.ts:50:12
Booting up worker for markdown bundle.ts:50:12
Booting up worker for template bundle.ts:50:12
Booting up worker for editor bundle.ts:50:12
Activated plug mermaid system.ts:120:12
Activated plug treeview system.ts:120:12
Booting up worker for treeview bundle.ts:50:12
Activated plug federation system.ts:120:12
Activated plug emoji system.ts:120:12
Activated plug share system.ts:120:12
Activated plug tasks system.ts:120:12
Activated plug search system.ts:120:12
Activated plug sync system.ts:120:12
Activated plug plug-manager system.ts:120:12
Activated plug markdown system.ts:120:12
Activated plug query system.ts:120:12
Activated plug editor system.ts:120:12
Activated plug index system.ts:120:12
Activated plug template system.ts:120:12
Loaded 0 functions and 0 commands from space-script common_system.ts:52:10
Now navigating to 
Object { page: "Docs/Test4", scrollTop: 0, selection: {…} }
client.ts:424:14
Updating page list cache client.ts:731:31
Flushed widget cache to store client.ts:1207:12
This site appears to use a scroll-linked positioning effect. This may not work well with asynchronous panning; see https://firefox-source-docs.mozilla.org/performance/scroll-linked_effects.html for further details and to join the discussion on related tools and features! Test4
Saving page Docs/Test4 client.ts:669:20
Page changed elsewhere, reloading. Old hash 1709537567755 new hash 1709537633649 client.ts:604:18
Reloading page client.ts:925:16
Flushed widget cache to store client.ts:1207:12

I’m running into the “Page changed elsewhere, and that is going to reload” frequently on a Synology DS720+, DS224+ and a Raspberry Pi with a SSD attached. I have a reverse proxy configuration on the Synology that points to any of the units and wondering if that would have any role to play… browser used is MS Edge.

I just set up silverbullet and experienced this same behavior. It was happening quite often for me and I was able to reproduce it with Chrome dev tools open. I think the trick is that a page save is taking a very long time (in my case 11.6 seconds). While that request is in-flight, index.json is also requested. That returns fast (76ms) and it appears the server’s response contains the updated timestamp, even though the PUT request is still pending. My guess is that the client is not accounting for the in-flight page save when it sees the updated timestamp in index.json, gets confused, concludes it’s a conflict, and thus reloads the page.

FWIW, I suspect my file-system (and not silverbullet) is at fault for the slow disk write.