Skip to content

adbc_postgresql: core dump if server terminates the connection #3878

@CaselIT

Description

@CaselIT

What happened?

If the postgresql server terminates the connection the processes crashes with a core dump

Stack Trace

terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_S_construct null not valid
Aborted (core dumped)

How can we reproduce the bug?

from adbc_driver_postgresql.dbapi import connect

uri = "postgresql://scott:tiger@localhost:5432/test"

conn = connect(uri)
conn2 = connect(uri)
c2Pid = conn2.execute("select pg_backend_pid()").fetchone()[0]
conn2.rollback()
print(c2Pid)
# just an example to simulate a server side termination of a connection
conn.execute("select pg_terminate_backend($1::int)", (c2Pid,))
print("terminated")
conn2.execute("select 1")
print("crashes above")

Environment/Setup

adbc-driver-manager 1.10.0 or 1.9.0
adbc-driver-postgresql 1.10.0 or 1.9.0
Os: windows or linux
Postgresql: 18 (but it should not matter)

Metadata

Metadata

Labels

Type: bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions