Skip to content

Conversation

@jurerotar
Copy link

Added forceReinitIfPreviouslyFailed to installOpfsSAHPoolVfs options, based on the discussion in #79

@sgbeal
Copy link
Collaborator

sgbeal commented Oct 27, 2025

FYIW, as the person who very reluctantly added the forceReinitIfPreviouslyFailed flag (#79): DO NOT USE THAT FLAG. It's a workaround for one specific buggy browser and actively supporting buggy browsers is how the world got stuck with MSIE6 for so long.

i strongly recommend leaving it out of any public interface. It's an ugly kludge for a buggy browser, not a solution to a real problem.

@jurerotar
Copy link
Author

First of all, thank you for implementing the fix (hack?)! 😄

The reason I've opened this PR is because I've encountered that same bug today. In my humble opinion, regardless whether this flag should exist, it seems there is currently still a need for it. The hope is of course that this will eventually get fixed on a browser-level, but until then, it may solve some users' problems (and save them some time by not having to dig through the whole #79 issue thread 😆).

I hope this makes sense, but feel free to close the PR in case my reasoning doesn't convince you!

@tomayac
Copy link
Collaborator

tomayac commented Oct 27, 2025

Is there a browser bug you could nudge with the negative impact caused by this and a small reproduction case for the engineers to look at? I understand you're vague on purpose, but I think in this case at least linking from said bug report (which hopefully exists) to here would be an option.

@jurerotar
Copy link
Author

Here's the bug I raised a couple of hours ago to WebKit: https://bugs.webkit.org/show_bug.cgi?id=301520 (it seems to only be happening there, haven't been able to reproduce elsewhere).

The issue appears very similar to the one described in #79.

@tomayac
Copy link
Collaborator

tomayac commented Oct 27, 2025

@karlcow This is a WebKit compat issue that currently affects users of SQLite Wasm. Any chance for someone from the team to take a look? Merci :-)

@karlcow
Copy link

karlcow commented Oct 27, 2025

Thanks @tomayac and @jurerotar for the heads up. Let me check.

@jurerotar
Copy link
Author

I've dug a bit more in to this issue during the holidays and managed to find a workaround that seems to work (more?) reliably.

I've updated the WebKit bug report referenced above, but I'll add the same update here in case anyone runs in to a similar issue.
The biggest thing that seems to have made the difference is how the app handles worker closing. Previously, workers closed itself by using self.close(). This seems to work fine in Chrome and Firefox, but on Safari, some resources seem to remain locked and in use. This prevented subsequent opening of those same resources, which caused the object is in invalid state errors.
I've experimented with removing self.close() calls and instead opting for worker.terminate() from the main thread. This seems to work better.

@tomayac, from my side, there's no need for this PR anymore, but I'd prefer if you made the decision on whether to close it or keep it open until we get an update from WebKit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants