Skip to content

[Bug] Arrow flight SQL process hanging after closing connection #36331

Description

@tgho-brrrr

Search before asking

  • I had searched in the issues and found no similar issues.

Version

doris == 2.1.4

What's Wrong?

The connections started by adbc_driver_flightsql or adbc_driver_manager both leave hanging processes:

CurrentConnected: Yes
Id: 0
User: admin
Host: 0.0.0.0:0
LoginTime: 2024-06-14 14:32:42
Catalog: internal
Db:
Command: Sleep
Time: 8
State: OK
QueryId: 972dbf17efa94eae-969e2b5697b4d0e4
Info: select 1;

After many queries the server will not accept any new connections to the DB unless we restart the FE.

What You Expected?

The process should be killed when the connection is closed

How to Reproduce?

Assuming arrow_flight_sql_port is 9090

Run this python script:

conn = flight_sql.connect(uri='grpc://127.0.0.1:9090', db_kwargs={
adbc_driver_manager.DatabaseOptions.USERNAME.value: "admin",
adbc_driver_manager.DatabaseOptions.PASSWORD.value: ""
})
cursor = conn.cursor()
cursor.execute("SELECT 1;")
cursor.close()
conn.close()

Then in the mysql console:
show processlist;

You should notice that the process hangs there indefinitly

Anything Else?

I also tried with the low-level adbc_driver_manager, and get the same issue, the problem should be on Doris side. I also tried to check that the driver indeed closes the connection by calling conn.cursor() after conn.close(), and I get an error, so the driver does it's part of the job, but it seems to not kill the process.

db = adbc_driver_flightsql.connect(uri="grpc://127.0.0.1:9090", db_kwargs={
adbc_driver_manager.DatabaseOptions.USERNAME.value: "admin",
adbc_driver_manager.DatabaseOptions.PASSWORD.value: "",
})
conn = adbc_driver_manager.AdbcConnection(db)
stmt = adbc_driver_manager.AdbcStatement(conn)
stmt.set_sql_query('select 1;')
stream, rows = stmt.execute_query()
stmt.close()
conn.close()
db.close()

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions