Skip to content

Spurious query failures with concurrent database connections #69

@stapelberg

Description

@stapelberg

Thanks for the txdb package, it’s a nice optimization when running many database tests :)

I noticed one issue, though, and wanted to ask if the issue is known or to be expected.

I’m working on a server which maintains multiple caches in the background (i.e. separate goroutines query the database and store the result in memory). My test code starts up a server and makes some database updates/queries itself.

Sometimes, the background goroutine which queries the database reports an error like update: pq: unexpected DataRow in simple query execution and the test itself errors out with pg.Close(): driver: bad connection.

These issues disappear once I add a pg.SetMaxOpenConns(1) call in my test setup.

So I was wondering: Are concurrent database connections supposed to work with txdb?

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