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
A Python UDF that calls back into its own connection hangs forever #61
This work was produced with the help of language models.
A Python UDF runs inside the query that holds the connection's engine lock, so execute() (or close(), or any other call) on that connection from the UDF waits for itself. The same happens when the UDF is folded while binding (RETURN f(1)), on the calling thread.
importladybugaslbconn=lb.Connection(lb.Database(":memory:"))
defreenter(x: int) ->int:
returnconn.execute("RETURN 1").get_next()[0] +xconn.create_function("reenter", reenter)
conn.execute("UNWIND range(1, 3) AS i RETURN sum(reenter(i))")
Expected: an error saying the connection is busy (after the fix: RuntimeError: A UDF cannot use a connection while it runs a query.). Actual: never returns.
A UDF that uses another, idle connection works and should keep working.
Activity