-
-
Notifications
You must be signed in to change notification settings - Fork 645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: secondary redbean SQLite WAL connections lock after first write #1228
Comments
Thank you for the test case to reproduce the issue. I ran into the same issue some time ago and even posted my example to the SQLite forum, but given that cosmo implementation on Windows is different from the "original" sqlite one (as it's using the same code that runs on unix), there wasn't much response. I can provide an additional case that may help with troubleshooting. Try commenting out the removal of the file on line one and then the "close" call will make all the difference between successful and failing cases:
Somehow calling I'm open to ideas/suggestions, as it affects one of my projects. |
You're getting an See this which is called in a loop here. I'd look for places where If this is happening when opening a new connection, I suspect the DMS lock might be involved. The Windows and Unix implementations are very different. Trying to do Windows by translating Unix syscalls is likely to introduce races here. |
I think the bug got fixed in 3.0.0? The repro now prints the expected output. Although I should note that the |
Nevermind, I just realized that |
@ncruces, thank you for the details. Do you have any further suggestions on what to check or how to troubleshoot this? It does work for me without closing the DB, so there is something that happens as part of this process that affects the subsequent processing, but I so far has not been able to find what that may be. |
No. I will note that what you're trying to do here is fraught with issues. I hope you've read sqlite.org/howtocorrupt.html, especially the entire section 2; also this. |
Contact Details
goldnstein64@gmail.com
What happened?
If two processes are connected to the same database with WAL enabled, a write operation on one connection will block all other connections until the writer disconnects.
Here is a reproduction of the issue along with its output, executed with
redbean -F FILE -i
The
parent:
messages appear after ~13 seconds. Making the write explicitly finish withBEGIN TRANSACTION
/END TRANSACTION
orCOMMIT
doesn't alter the program's behavior. A more obvious repro would probably be creating a table in theddl_db
block and having both processes insert values into the table.The expected output for this program would likely be:
Version
redbean 2.2
What operating system are you seeing the problem on?
Windows
Relevant log output
The text was updated successfully, but these errors were encountered: