powersync-js icon indicating copy to clipboard operation
powersync-js copied to clipboard

intermittent error occurs when using OPFSCoopSyncVFS

Open ImSingee opened this issue 6 months ago • 3 comments

An intermittent error occurs when using OPFSCoopSyncVFS:

Failed to execute 'createSyncAccessHandle' on 'FileSystemFileHandle': Access Handles cannot be created if there is another open Access Handle or Writable stream associated with the same file.

This error has been observed in all versions since OPFS support was introduced.

The issue is intermittent and seems more likely to occur under the following conditions:

  • Leaving the page open in the background for several hours, especially after the computer has been asleep.
  • Quickly switching away from the page and then back to it

The error can occur with either a single tab or multiple tabs open (with the same powersync db).

If there's more than one tabs open, when the error occurs, all other pages can no longer execute SQL queries, and the sync status gets stuck on "connecting".

The only way to recover is to close all application tabs and reopen them.

ImSingee avatar Jul 11 '25 19:07 ImSingee

Thanks @ImSingee we'll look into it.

michaelbarnes avatar Jul 11 '25 19:07 michaelbarnes

Hey @ImSingee, I've been having trouble reproducing this issue on my side. Are you using the latest versions of our Web SDK? If you already are it would be good to get a bit more information about the error. Is there any more context (or stack traces) when you hit this problem?

Chriztiaan avatar Jul 21 '25 08:07 Chriztiaan

Hi @Chriztiaan, Thanks for your follow-up!

This happens very rarely (less than once a month). I didn't set up a trace for this previously. I've set up the Sentry trace now, and if this issue occurs again, I will do my best to post more information here.

ImSingee avatar Jul 29 '25 05:07 ImSingee