You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Connection.close() while another thread runs a query hangs or crashes the interpreter #60
This work was produced with the help of language models.
Connection.close() destroys the native connection while a query on it is still running in another thread. Depending on the query, an unparameterized query hangs or aborts with heap corruption, a write segfaults, and a parameterized query makes close() wait for it. AsyncConnection.close() hits the same path, since it closes its connections before shutting down its executor.
importthreading, time, ladybugaslbconn=lb.Connection(lb.Database("db"))
q="WITH range(1, 60000) AS r UNWIND r AS x UNWIND r AS y RETURN sum(x * y)"threading.Thread(target=conn.execute, args=(q,)).start()
time.sleep(0.3)
conn.close()
Expected:close() returns, and the query ends with an error rather than taking the process down. Actual:close() hangs, or the interpreter aborts or segfaults.
Reproduced with the ladybug==0.21.2 wheel on CPython 3.13.16 and 3.14.8, and on main (548c183) with CPython 3.12.
Activity