Skip to content

[Java] infinite loop during Auth when Python adbc_driver_flightsql.connect to Java Flight Server #37722

Description

@xinyiZzz

Describe the usage question you have. Please include as many useful details as possible.

I implemented an Arrow Flight SQL Server using JAVA and tried to connect to it using Python, using Apache Arrow 13.0.0. I'm having a Infinite loop problem and looking for help. Infinite loop at the code position below:
image
image
It seems to because AuthObserver::onNext is not being called correctly, Is this related to the Protobuf version?

Arrow Flight SQL Server using JAVA, complete code is here: apache/doris#24314

<arrow.version>13.0.0</arrow.version>
<grpc.version>1.56.0</grpc.version>
<protobuf.version>3.23.1</protobuf.version>
<protoc.artifact.version>3.24.3</protoc.artifact.version>
FlightSqlService.java
public FlightSqlService(int port) {
BufferAllocator allocator = new RootAllocator();
Location location = Location.forGrpcInsecure("0.0.0.0", port);
FlightSqlServiceImpl producer = new FlightSqlServiceImpl(location);
flightServer = FlightServer.builder(allocator, location, producer)
.authHandler(new BasicServerAuthHandler(new FlightServerBasicAuthValidator())).build();
}
flightServer.start();
FlightSqlServiceImpl.java
public class FlightSqlServiceImpl implements FlightSqlProducer, AutoCloseable {
public FlightSqlServiceImpl(final Location location) {
this.location = location;
sqlInfoBuilder = new SqlInfoBuilder();
sqlInfoBuilder.withFlightSqlServerName("DorisFE")
.withFlightSqlServerVersion("1.0")
.withFlightSqlServerArrowVersion("13.0.0")
.withFlightSqlServerReadOnly(false)
.withSqlIdentifierQuoteChar("`")
.withSqlDdlCatalog(true)
.withSqlDdlSchema(false)
.withSqlDdlTable(false)
.withSqlIdentifierCase(SqlSupportedCaseSensitivity.SQL_CASE_SENSITIVITY_CASE_INSENSITIVE)
.withSqlQuotedIdentifierCase(SqlSupportedCaseSensitivity.SQL_CASE_SENSITIVITY_CASE_INSENSITIVE);
}
}
FlightServerBasicAuthValidator.java
public class FlightServerBasicAuthValidator implements BasicServerAuthHandler.BasicAuthValidator {
private static final String myToken = "DORIS_READ_WRITE_TOKEN";
@Override
public byte[] getToken(String username, String password) {
return myToken.getBytes(Charsets.UTF_8);
}
@Override
public Optional<String> isValid(byte[] bytes) {
return Optional.of(myToken);
}
}

Connect using Python ADBC

tp version:
adbc_driver_flightsql-0.6.0
adbc_driver_manager-0.6.0
pyarrow-13.0.0
import adbc_driver_flightsql.dbapi as flight_sql
import adbc_driver_flightsql
import adbc_driver_manager
db = adbc_driver_flightsql.connect(uri="grpc://xxx:10478", db_kwargs={
adbc_driver_manager.DatabaseOptions.USERNAME.value: "root",
adbc_driver_manager.DatabaseOptions.PASSWORD.value: "",
})
conn = adbc_driver_manager.AdbcConnection(db)
stmt = adbc_driver_manager.AdbcStatement(conn)

if not add DatabaseOptions.USERNAME and DatabaseOptions.PASSWORD, can connect it normally

db = adbc_driver_flightsql.connect(uri="grpc://xxx:10478")

Component(s)

FlightRPC

Activity

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions