prmoore77 opened a new issue, #853:
URL: https://github.com/apache/arrow-adbc/issues/853
Attempting to use Python package: adbc-driver-flightsql==0.5.1 - against a
Flight SQL server with the following Python code use-case causes a driver panic
when running the final `SELECT * FROM map_table` command:
```
import adbc_driver_flightsql.dbapi as flight_sql
def main():
with flight_sql.connect(uri=f"grpc+tls://localhost:31337",
db_kwargs={"username": "flight_username",
"password": "flight_password",
"adbc.flight.sql.client_option.tls_skip_verify": "true"
}
) as conn:
with conn.cursor() as cur:
cur.execute(operation="CREATE TABLE map_table (map_col
MAP(VARCHAR, DOUBLE))")
with conn.cursor() as cur:
cur.execute(operation="""INSERT INTO map_table (map_col)
VALUES (MAP {'hey': 123.456})""")
with conn.cursor() as cur:
cur.execute(operation="SELECT * FROM map_table;")
pyarrow_table = cur.fetch_arrow_table()
print(f"Number of rows fetched: {pyarrow_table.num_rows}")
print(pyarrow_table.to_pandas())
if __name__ == "__main__":
main()
```
Error:
```
FlightSQL driver panicked, stack traces:
goroutine 17 [running, locked to thread]:
main.poison(0x1400045d548?, {0x11de26a34, 0x19}, {0x11e049c00,
0x14000038168})
/Users/runner/work/arrow-adbc/arrow-adbc/adbc/go/adbc/pkg/flightsql/driver.go:97
+0xa8
main.FlightSQLStatementExecuteQuery.func1()
/Users/runner/work/arrow-adbc/arrow-adbc/adbc/go/adbc/pkg/flightsql/driver.go:691
+0x58
panic({0x11e049c00, 0x14000038168})
/Users/runner/hostedtoolcache/go/1.18.10/x64/src/runtime/panic.go:838
+0x20c
github.com/apache/arrow-adbc/go/adbc/utils.removeFieldMetadata(0x1400045da10)
/Users/runner/work/arrow-adbc/arrow-adbc/adbc/go/adbc/utils/utils.go:49
+0x4e8
github.com/apache/arrow-adbc/go/adbc/utils.RemoveSchemaMetadata(0x140002fa300)
/Users/runner/work/arrow-adbc/arrow-adbc/adbc/go/adbc/utils/utils.go:25
+0x140
github.com/apache/arrow-adbc/go/adbc/driver/flightsql.newRecordReader({0x11e09d8d0,
0x14000372930}, {0x11e09ca78, 0x1400003b100}, 0x14000304080, 0x14000322000,
{0x11e0a3710?, 0x1400031a1e0?}, 0x11df96e00?, {0x140002e0140, ...})
/Users/runner/work/arrow-adbc/arrow-adbc/adbc/go/adbc/driver/flightsql/record_reader.go:125
+0x560
github.com/apache/arrow-adbc/go/adbc/driver/flightsql.(*statement).ExecuteQuery(0x140000c8090,
{0x11e09d860, 0x1400003a080})
/Users/runner/work/arrow-adbc/arrow-adbc/adbc/go/adbc/driver/flightsql/flightsql_statement.go:246
+0x228
main.FlightSQLStatementExecuteQuery(0x1400007e000?, 0x11990b200,
0x16f88ed48, 0x16f88ed50)
/Users/runner/work/arrow-adbc/arrow-adbc/adbc/go/adbc/pkg/flightsql/driver.go:709
+0xa4
goroutine 4 [select]:
google.golang.org/grpc.(*ccBalancerWrapper).watcher(0x1400014af40)
/Users/runner/go/pkg/mod/google.golang.org/[email protected]/balancer_conn_wrappers.go:115
+0x68
created by google.golang.org/grpc.newCCBalancerWrapper
/Users/runner/go/pkg/mod/google.golang.org/[email protected]/balancer_conn_wrappers.go:76
+0x228
goroutine 7 [IO wait]:
internal/poll.runtime_pollWait(0x119a40e98, 0x72)
/Users/runner/hostedtoolcache/go/1.18.10/x64/src/runtime/netpoll.go:302
+0xa4
internal/poll.(*pollDesc).wait(0x140000d2180?, 0x14000382000?, 0x0)
/Users/runner/hostedtoolcache/go/1.18.10/x64/src/internal/poll/fd_poll_runtime.go:83
+0x2c
internal/poll.(*pollDesc).waitRead(...)
/Users/runner/hostedtoolcache/go/1.18.10/x64/src/internal/poll/fd_poll_runtime.go:88
internal/poll.(*FD).Read(0x140000d2180, {0x14000382000, 0xa01, 0xa01})
/Users/runner/hostedtoolcache/go/1.18.10/x64/src/internal/poll/fd_unix.go:167
+0x1ec
net.(*netFD).Read(0x140000d2180, {0x14000382000?, 0x14000280c18?, 0x8?})
/Users/runner/hostedtoolcache/go/1.18.10/x64/src/net/fd_posix.go:55
+0x2c
net.(*conn).Read(0x140000103d0, {0x14000382000?, 0x11a716e00?, 0x11a716d00?})
/Users/runner/hostedtoolcache/go/1.18.10/x64/src/net/net.go:183 +0x38
crypto/tls.(*atLeastReader).Read(0x1400000e408, {0x14000382000?, 0x0?,
0x11d80c208?})
/Users/runner/hostedtoolcache/go/1.18.10/x64/src/crypto/tls/conn.go:785
+0x44
bytes.(*Buffer).ReadFrom(0x14000280cf8, {0x11e098958, 0x1400000e408})
/Users/runner/hostedtoolcache/go/1.18.10/x64/src/bytes/buffer.go:204
+0x94
crypto/tls.(*Conn).readFromUntil(0x14000280a80, {0x119a9d118?,
0x140000103d0}, 0xa01?)
/Users/runner/hostedtoolcache/go/1.18.10/x64/src/crypto/tls/conn.go:807
+0xd8
crypto/tls.(*Conn).readRecordOrCCS(0x14000280a80, 0x0)
/Users/runner/hostedtoolcache/go/1.18.10/x64/src/crypto/tls/conn.go:614
+0xdc
crypto/tls.(*Conn).readRecord(...)
/Users/runner/hostedtoolcache/go/1.18.10/x64/src/crypto/tls/conn.go:582
crypto/tls.(*Conn).Read(0x14000280a80, {0x14000390000, 0x8000, 0x11d80e970?})
/Users/runner/hostedtoolcache/go/1.18.10/x64/src/crypto/tls/conn.go:1285 +0x180
bufio.(*Reader).Read(0x140002fbd40, {0x140003a8040, 0x9, 0x140000c2150?})
/Users/runner/hostedtoolcache/go/1.18.10/x64/src/bufio/bufio.go:236
+0x1ec
io.ReadAtLeast({0x11e0987f8, 0x140002fbd40}, {0x140003a8040, 0x9, 0x9}, 0x9)
/Users/runner/hostedtoolcache/go/1.18.10/x64/src/io/io.go:331 +0xac
io.ReadFull(...)
/Users/runner/hostedtoolcache/go/1.18.10/x64/src/io/io.go:350
golang.org/x/net/http2.readFrameHeader({0x140003a8040?, 0x9?, 0x0?},
{0x11e0987f8?, 0x140002fbd40?})
/Users/runner/go/pkg/mod/golang.org/x/[email protected]/http2/frame.go:237
+0x5c
golang.org/x/net/http2.(*Framer).ReadFrame(0x140003a8000)
/Users/runner/go/pkg/mod/golang.org/x/[email protected]/http2/frame.go:498
+0x84
google.golang.org/grpc/internal/transport.(*http2Client).reader(0x140002e8240,
0x0?)
/Users/runner/go/pkg/mod/google.golang.org/[email protected]/internal/transport/http2_client.go:1592
+0x130
created by google.golang.org/grpc/internal/transport.newHTTP2Client
/Users/runner/go/pkg/mod/google.golang.org/[email protected]/internal/transport/http2_client.go:394
+0x1428
goroutine 8 [select]:
google.golang.org/grpc/internal/transport.(*controlBuffer).get(0x14000044960,
0x1)
/Users/runner/go/pkg/mod/google.golang.org/[email protected]/internal/transport/controlbuf.go:417
+0x15c
google.golang.org/grpc/internal/transport.(*loopyWriter).run(0x140003804d0)
/Users/runner/go/pkg/mod/google.golang.org/[email protected]/internal/transport/controlbuf.go:549
+0x80
google.golang.org/grpc/internal/transport.newHTTP2Client.func6()
/Users/runner/go/pkg/mod/google.golang.org/[email protected]/internal/transport/http2_client.go:448
+0x70
created by google.golang.org/grpc/internal/transport.newHTTP2Client
/Users/runner/go/pkg/mod/google.golang.org/[email protected]/internal/transport/http2_client.go:446
+0x1908
Traceback (most recent call last):
File "/Users/philip/Documents/git/ADBC-vs-JDBC/test_map.py", line 19, in
main
cur.execute(operation="SELECT * FROM map_table;")
File
"/Users/philip/Documents/git/ADBC-vs-JDBC/venv/lib/python3.11/site-packages/adbc_driver_manager/dbapi.py",
line 601, in execute
handle, self._rowcount = self._stmt.execute_query()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "adbc_driver_manager/_lib.pyx", line 987, in
adbc_driver_manager._lib.AdbcStatement.execute_query
File "adbc_driver_manager/_lib.pyx", line 381, in
adbc_driver_manager._lib.check_error
adbc_driver_manager._lib.InternalError: ADBC_STATUS_INTERNAL (9):
[FlightSQL] AdbcStatementExecuteQuery: Go panic in FlightSQL driver (see
stderr): runtime.boundsError{x:1, y:1, signed:true, code:0x0}
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/philip/Documents/git/ADBC-vs-JDBC/test_map.py", line 18, in
main
with conn.cursor() as cur:
File
"/Users/philip/Documents/git/ADBC-vs-JDBC/venv/lib/python3.11/site-packages/adbc_driver_manager/dbapi.py",
line 217, in __exit__
self.close()
File
"/Users/philip/Documents/git/ADBC-vs-JDBC/venv/lib/python3.11/site-packages/adbc_driver_manager/dbapi.py",
line 543, in close
self._stmt.close()
File "adbc_driver_manager/_lib.pyx", line 959, in
adbc_driver_manager._lib.AdbcStatement.close
File "adbc_driver_manager/_lib.pyx", line 965, in
adbc_driver_manager._lib.AdbcStatement.close
File "adbc_driver_manager/_lib.pyx", line 381, in
adbc_driver_manager._lib.check_error
adbc_driver_manager._lib.InternalError: ADBC_STATUS_INTERNAL (9):
[FlightSQL] AdbcStatementRelease: Go panicked, driver is in unknown state
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/philip/Documents/git/ADBC-vs-JDBC/test_map.py", line 26, in
<module>
main()
File "/Users/philip/Documents/git/ADBC-vs-JDBC/test_map.py", line 5, in
main
with flight_sql.connect(uri=f"grpc+tls://localhost:31337",
File
"/Users/philip/Documents/git/ADBC-vs-JDBC/venv/lib/python3.11/site-packages/adbc_driver_manager/dbapi.py",
line 217, in __exit__
self.close()
File
"/Users/philip/Documents/git/ADBC-vs-JDBC/venv/lib/python3.11/site-packages/adbc_driver_manager/dbapi.py",
line 302, in close
self._conn.close()
File "adbc_driver_manager/_lib.pyx", line 852, in
adbc_driver_manager._lib.AdbcConnection.close
File "adbc_driver_manager/_lib.pyx", line 858, in
adbc_driver_manager._lib.AdbcConnection.close
File "adbc_driver_manager/_lib.pyx", line 381, in
adbc_driver_manager._lib.check_error
adbc_driver_manager._lib.ProgrammingError: ADBC_STATUS_INVALID_STATE (6):
[FlightSQL] AdbcConnectionRelease: Go panicked, driver is in unknown state
Exception ignored in: <function Cursor.__del__ at 0x1199cc680>
Traceback (most recent call last):
File
"/Users/philip/Documents/git/ADBC-vs-JDBC/venv/lib/python3.11/site-packages/adbc_driver_manager/dbapi.py",
line 698, in __del__
self.close()
File
"/Users/philip/Documents/git/ADBC-vs-JDBC/venv/lib/python3.11/site-packages/adbc_driver_manager/dbapi.py",
line 543, in close
self._stmt.close()
File "adbc_driver_manager/_lib.pyx", line 958, in
adbc_driver_manager._lib.AdbcStatement.close
File "adbc_driver_manager/_lib.pyx", line 445, in
adbc_driver_manager._lib._AdbcHandle._close_child
File "adbc_driver_manager/_lib.pyx", line 447, in
adbc_driver_manager._lib._AdbcHandle._close_child
RuntimeError: Underflow in closing this AdbcStatement
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
```
The same SQL use case seems to work fine with the Flight SQL JDBC driver -
this SQL all works when connecting to the same Flight SQL server:
```
CREATE TABLE map_table (map_col MAP(VARCHAR, DOUBLE));
INSERT INTO map_table (map_col)
VALUES (MAP {'hey': 123.456});
SELECT * FROM map_table;
```
Details - I'm running the Flight SQL server using Docker on a Mac - with
command:
```
docker run --name flight-sql \
--detach \
--rm \
--tty \
--init \
--publish 31337:31337 \
--env FLIGHT_PASSWORD="flight_password" \
--env PRINT_QUERIES="1" \
--pull missing \
voltrondata/flight-sql:latest
```
(built from this repo for the server:
https://github.com/voltrondata/flight-sql-server-example)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]