Skip to content

bad_weak_ptr #219

Closed
Closed
@thomasrynnetopaz

Description

@thomasrynnetopaz

What happens?

Intermittently when running automated tests that create and close in memory duckdb databases via jdbc we see the error:
java.sql.SQLException: java.sql.SQLException: Invalid Error: bad_weak_ptr
at org.duckdb.DuckDBPreparedStatement.prepare(DuckDBPreparedStatement.java:121)
at org.duckdb.DuckDBPreparedStatement.(DuckDBPreparedStatement.java:75)
at org.duckdb.DuckDBConnection.prepareStatement(DuckDBConnection.java:80)
at org.duckdb.DuckDBConnection.prepareStatement(DuckDBConnection.java:192)

We can not reliably reproduce this error but have seen it several times

The DuckDB database is given 2GiB of memory. We are running with java 17 on Linux with x64 hardware.

A different test fails each time but most of the tests create about 10 tables, insert about 2,000 rows using the DuckDBAppender and then run some queries.

As an example, the last failure:
successfully ran 90 tests (using a fresh in memory database for each)
failed with the bad_weak_ptr exception
successfully ran 150 tests (using a fresh in memory database for each)
failed again with the bad_weak_ptr exception
successfully ran 200 tests (using a fresh in memory database for each)

The in memory databases are created using DriverManager.getConnection("jdbc:duckdb::memory:random-string") and closed using DuckDBConnection.close()

To Reproduce

I can not reliably reproduce this error

OS:

Linux

DuckDB Version:

1.2.2.0

DuckDB Client:

jdbc

Hardware:

No response

Full Name:

Thomas Rynne

Affiliation:

Topaz

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a stable release

Did you include all relevant data sets for reproducing the issue?

Not applicable - the reproduction does not require a data set

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions