-
Notifications
You must be signed in to change notification settings - Fork 25
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
How to deal with IO Error: Cannot open file...used by another process
?
#56
Comments
Probably related to duckdb/duckdb#7826 |
Update: I get the same error connecting to the database with DBeaver, so it's probably unrelated to this package. The only thing that's worked so far is my coworkers and I closing all of our RStudio sessions, so now I'm thinking it's a duckdb-RStudio thing. |
Hi daranzolin, Duckdb recently merged a PR that adds information about what process is using the duckdb file. Don't know if it helps though. |
@Tmonster thanks for letting me know! Does updating duckdb the R package include the updates to the duckdb source repo? |
Hi daranzolin, The current duckdb R package does not have this feature yet. There is a new Duck release planned soon, which will prompt a new duckdb-r package soon after. You can build a developmental build of the duckdb-r package by following these instructions if you are curious about the new functionality. You can let me know here if you have any questions https://github.com/duckdb/duckdb-r/?tab=readme-ov-file#building |
I would just like to add that we've come across this error too, despite also being vigilant about disconnecting with |
This looks much better in #124, I'll merge it today, binaries will be available on https://duckdb.r-universe.dev/duckdb# soon. Can you confirm? |
Hi @krlmlr - unfortunately it will be difficult for me to confirm until a release is published on CRAN, because of the two environments I work in. Hopefully the OP can test. |
@nicki-dese @daranzolin: Are you still seeing this with v0.10.1? |
Thanks @krlmlr! Trying to test this now, but ironically I can't update/install it because of the same error:
I'll try shutting everything down and restarting later this week. |
Thanks, David. Windows loves locking files... |
Thanks so much for following up @krlmlr - I've had time to test in one of the two environments (fairly quickly, and not using targets), and it seems to have stopped occurring! :) Having said that - what is the expected behaviour if you try to connect to the same database twice, both with
My expectation would be an error with the second attempt, because duckdb only allows one write connection to avoid conflicts. It used to give you the Let me know if I can help further. |
Thanks, @nicki-dese. Two read-write connections from the same R session are supported, connecting from different R sessions should raise an error. Can you confirm? |
Hi @krlmlr - yes, if I open another R session by opening a 2nd instance of R studio, it does give me an error. A very sensible error:
I think something a bit weird is going on between connecting to a database with read_only = T, disconnecting, and then going back and connecting with read_only = F. It doesn't seem to update the connection type, even if you delete the connection object, and then try connecting with read_only = F. I have attached an excel file showing the testing I've done - let me know if that format doesn't work for you. |
Thanks. Yes, I think this is a consequence of the "read-onlyness" being a property of the driver object (created by In this scenario, what happens if you add one or two This is discussed in #83 (comment), let's continue there. |
I've started implementing duckdb at work using {targets} and RStudio. However, between a couple coworkers, various workflows are persistently ground to a halt with:
We've tried being extra vigilant by always connecting with:
And always disconnecting with:
But when where we need to update tables in the database and we connect with
read_only = FALSE
, the 'used by another process' error always appears and we can't ascertain where there's a lingering connection, even after disconnecting, clearing our environments, and restarting R. Is this possibly an RStudio thing? Any guidance on managing connections would be greatly appreciated.The text was updated successfully, but these errors were encountered: