FATAL Error: Failed to create checkpoint because of error...
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Reproduce the reported workload with Java 17, DuckDB 1.2.1, duplicate connections, CompletableFuture.runAsync, and batched prepared INSERTs. Start at DuckDBPreparedStatement.executeBatch and the native duckdb_jdbc_execute entry in the stack trace, then trace connection closing and checkpoint behavior. Done means identifying the cause of the WAL deletion failure and documenting a verified fix or workaround.
Written by the indexing model from the issue text.
Description
JAVA 17, DuckDB 1.2 (duckdb_jdbc-1.2.1.jar)
I am trying to perform some queued INSERTs (specifically preparedStatement, batch inserts) using CompletableFuture (i.e. background executor, but same process). All these go to the same table.
The background method uses (partially) :
try (var connection = duckDBConnection.duplicate(); var statement = connection.prepareStatement(INSERT_TEMPLATE))) { for (...) { statement.setString(); statement.set... statement.addBatch(); ... } statement.executeBatch(); }
I'm using CompletableFuture.runAsync, so these go on the Java commonPool() executor, queued to run asap.
After a few of these complete, I'm getting the exception:
java.sql.SQLException: FATAL Error: Failed to create checkpoint because of error: Failed to delete file "e:\vectorindex\efr.duckdb.wal": The process cannot access the file because it is being used by another process.
at org.duckdb.DuckDBNative.duckdb_jdbc_execute(Native Method)
at org.duckdb.DuckDBPreparedStatement.execute(DuckDBPreparedStatement.java:148)
at org.duckdb.DuckDBPreparedStatement.executeBatchedPreparedStatement(DuckDBPreparedStatement.java:489)
at org.duckdb.DuckDBPreparedStatement.executeBatch(DuckDBPreparedStatement.java:474)
...`
This is entirely unexpected since all of the code is running in the same process, and according to the docs, this should be fine. And they are all unique INSERTs (there isn't even a PK on the table), so there should be no row-based table contention.
It appears that DuckDB is performing checkpoints on its own...maybe when the duplicate session is closing in the method? And whether it is performing checkpoints or not, this appears to be a bug, because it's documented that multiple threads within the same process should be able to r/w the same database.
Does the WAL strategy need to be adjusted (internally)?
Are there any workarounds for now?
Thanks!
- Dominant language
- C++
- Stars
- 127
- Forks
- 80
- Avg merge
- 13h 41m
- Merged PRs (30d)
- 44
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from duckdb/duckdb-java
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
duckdb/duckdb-java#832 · 2 comments ·
-
Native SIGSEGV in DuckDB JDBC when repeatedly executing queries with window functions and LIMIT 0 Open
Difficulty 4/5 3-5 days Newbie friendliness 48/100
duckdb/duckdb-java#871 · 4 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
duckdb/duckdb-java#872 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
duckdb/duckdb-java#837 ·
-
executeBatch()` on a prepared INSERT runs s are ~1–2 orders of magnitude slower than the Appender Open
Difficulty 5/5 Over a week Newbie friendliness 42/100
duckdb/duckdb-java#815 · 1 comment ·
All issues in duckdb/duckdb-java
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·