You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "xinyiZzz (via GitHub)" <gi...@apache.org> on 2023/09/14 13:46:04 UTC
[GitHub] [arrow] xinyiZzz opened a new issue, #37722: [Java] infinite loop during Auth when Python `adbc_driver_flightsql.connect` to Java Flight Server
xinyiZzz opened a new issue, #37722:
URL: https://github.com/apache/arrow/issues/37722
### 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](https://github.com/apache/arrow/assets/13197424/a3063f07-5b70-4429-a5e0-ba371178f628)
![image](https://github.com/apache/arrow/assets/13197424/3fad682d-95c7-4bd3-ab58-0464235373eb)
It seems to because `AuthObserver::onNext` is not being called correctly, Is this related to the Protobuf version?
Arrow Flight SQL Server using JAVA:
```
<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
--
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: issues-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] lidavidm commented on issue #37722: [Java] infinite loop during Auth when Python `adbc_driver_flightsql.connect` to Java Flight Server
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #37722:
URL: https://github.com/apache/arrow/issues/37722#issuecomment-1719538203
Thanks for the report, I'll try to find some time to replicate and debug
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] lidavidm commented on issue #37722: [Java] infinite loop during Auth when Python `adbc_driver_flightsql.connect` to Java Flight Server
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #37722:
URL: https://github.com/apache/arrow/issues/37722#issuecomment-1723338476
Ah - thanks for the update, unfortunately I haven't had time to look at this yet
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] lidavidm closed issue #37722: [Java] infinite loop during Auth when Python `adbc_driver_flightsql.connect` to Java Flight Server
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm closed issue #37722: [Java] infinite loop during Auth when Python `adbc_driver_flightsql.connect` to Java Flight Server
URL: https://github.com/apache/arrow/issues/37722
--
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: issues-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] xinyiZzz commented on issue #37722: [Java] infinite loop during Auth when Python `adbc_driver_flightsql.connect` to Java Flight Server
Posted by "xinyiZzz (via GitHub)" <gi...@apache.org>.
xinyiZzz commented on issue #37722:
URL: https://github.com/apache/arrow/issues/37722#issuecomment-1730739306
Thanks for your reply, I will use `ServerMiddleware` instead of `ServerAuthHandler`. As you said https://github.com/apache/arrow/issues/37824, `ServerAuthHandler` has been deprecated in Arrow 13.0.0
If Arrow 13.0.0 no longer supports old authentication, it seems that can be marked in the Documentation and 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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] xinyiZzz commented on issue #37722: [Java] infinite loop during Auth when Python `adbc_driver_flightsql.connect` to Java Flight Server
Posted by "xinyiZzz (via GitHub)" <gi...@apache.org>.
xinyiZzz commented on issue #37722:
URL: https://github.com/apache/arrow/issues/37722#issuecomment-1720364940
https://arrow.apache.org/docs/cpp/api/flight.html#_CPPv4N5arrow6flight17ServerAuthHandler12AuthenticateEP16ServerAuthSenderP16ServerAuthReader
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] lidavidm commented on issue #37722: [Java] infinite loop during Auth when Python `adbc_driver_flightsql.connect` to Java Flight Server
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #37722:
URL: https://github.com/apache/arrow/issues/37722#issuecomment-1731531596
Ok, I looked at the Java side and yes - this is also the 'old' auth implementation (that tries to use a stateful "login" flow). So it's getting stuck waiting for a message that never comes (since the Flight SQL client uses a more modern authentication flow). I'll mark it deprecated (without intent to remove) and explain the issues. Thanks for reporting and thanks for bearing with us.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] lidavidm commented on issue #37722: [Java] infinite loop during Auth when Python `adbc_driver_flightsql.connect` to Java Flight Server
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #37722:
URL: https://github.com/apache/arrow/issues/37722#issuecomment-1730455124
sorry - I'm going to block off some time tomorrow so I can actually look at this, thanks for your patience
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] xinyiZzz commented on issue #37722: [Java] infinite loop during Auth when Python `adbc_driver_flightsql.connect` to Java Flight Server
Posted by "xinyiZzz (via GitHub)" <gi...@apache.org>.
xinyiZzz commented on issue #37722:
URL: https://github.com/apache/arrow/issues/37722#issuecomment-1722518633
Fortunately! I successfully implemented authentication using `auth2`.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] xinyiZzz commented on issue #37722: [Java] infinite loop during Auth when Python `adbc_driver_flightsql.connect` to Java Flight Server
Posted by "xinyiZzz (via GitHub)" <gi...@apache.org>.
xinyiZzz commented on issue #37722:
URL: https://github.com/apache/arrow/issues/37722#issuecomment-1731610808
Many thanks 🙏
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] xinyiZzz commented on issue #37722: [Java] infinite loop during Auth when Python `adbc_driver_flightsql.connect` to Java Flight Server
Posted by "xinyiZzz (via GitHub)" <gi...@apache.org>.
xinyiZzz commented on issue #37722:
URL: https://github.com/apache/arrow/issues/37722#issuecomment-1729363990
I reproduced the same problem on cpp flight server.
```
auth.h
class FlightSqlServerAuthHandler : public arrow::flight::ServerAuthHandler {
arrow::Status Authenticate(const arrow::flight::ServerCallContext& context, arrow::flight::ServerAuthSender* outgoing,
arrow::flight::ServerAuthReader* incoming) override;
};
auth.cpp
arrow::Status FlightSqlServerAuthHandler::Authenticate(const arrow::flight::ServerCallContext& context, arrow::flight::ServerAuthSender* outgoing,
arrow::flight::ServerAuthReader* incoming) {
RETURN_NOT_OK(incoming->Read(&token)); // stuck here
}
server.cpp
flight_options.auth_handler = std::make_unique<FlightSqlServerAuthHandler>();
RETURN_DORIS_STATUS_IF_ERROR(Init(flight_options));
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org