-
Notifications
You must be signed in to change notification settings - Fork 238
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
PANIC: could not locate a valid checkpoint record #327
Comments
I bet #246 would help solve this problem. The problem is the WAL getting corrupted. Maybe if I could change settings like Although I am very confused why calling |
There was a bug in 0.2.7 where it wasn't checkpointing the WAL on close, 0.2.8 fixes that. Does it still happen? |
@samwillis Actually, it does seem like if I call |
Thank you for fixing this! I am able to use in-memory completely in my tests now, and getting close to being able to use the FS in local dev. I am still encountering other bugs. I will close this and make a separate issue. (Also, I am fighting with Deno to make it do the right thing on sigint, but that's Deno's fault.) The docs should highlight the importance of calling |
Btw it does seem to be an issue with my workload, because I can't create a test that reproduces the problem, even with nodefs storage in Deno. I will try to do that before opening another issue. |
Oh boy, I figured it out! It's my Web Worker. I am creating a second PGlite instance inside of a Web Worker in Deno and that's making everything go crazy. If I delete that it works perfectly. Even sigint does not corrupt my database. 🤦 Maybe it's just a concurrency issue? Probably both processes touching the pglite database at the same time is what corrupted it in the first place. |
Yeh, two connections to the same datadir isn't supported and will do crazy things. I'm hopeful we can support it in future, but there engineering (and possibly lobbying of browser devs) needed first. |
Btw, I just wanted to say I fixed the problem in my code. I was not meaning to run 2 instances of PGlite, just an accident. So once I sorted that out, PGlite works perfectly in Deno. 👍 Now I'm very happy. Thanks again for this awesome and brave project! |
Follow up to #321
On Deno v1.46.3, I am creating a pglite instance with
file://data/pgdata
(so nodefs). After closing the process and starting the existing database again, it seems the database is corrupted:(I am running a fork with #306, but I don't think this code change is related)EDIT: I am running pglite 0.2.8.Background
If I start fresh with no pglite data on disk, I see this a ton of debug logs, including this error:
after this, the deno process stays alive and continues for a couple seconds, until the http server is started then it finally crashes:
After this, if I quit and run again, I can use PGlite normally!
After this first set of errors, if I start
deno task dev
again, the whole thing works without any issues! That is, until I Ctrl+C and start again.PANIC: could not locate a valid checkpoint record
Now after starting again, I get the first error.
What I tried
I tried adding a SIGINT listener in my application code to manually call
pglite.close()
, ensuring it's closed cleanly. This didn't help.What I didn't try:
a different version of PGlite (I can't because this database relies a lot on json, and needs Fix array serialization #306)The text was updated successfully, but these errors were encountered: