Skip to content

Commit

Permalink
Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
lidavidm committed Aug 8, 2023
1 parent ea7fa4f commit e2738ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cpp/src/arrow/flight/test_definitions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1870,6 +1870,7 @@ void AsyncClientTest::TestGetFlightInfo() {
ASSERT_THAT(listener->future_.status().ToString(), ::testing::HasSubstr("Sentinel"));
ASSERT_EQ(0, listener->counter_);
}

void AsyncClientTest::TestGetFlightInfoFuture() {
auto descr = FlightDescriptor::Command("status-outofmemory");
auto future = client_->GetFlightInfoAsync(descr);
Expand All @@ -1884,6 +1885,7 @@ void AsyncClientTest::TestGetFlightInfoFuture() {
ASSERT_EQ(1000, info.total_records());
ASSERT_EQ(100000, info.total_bytes());
}

void AsyncClientTest::TestListenerLifetime() {
arrow::Future<FlightInfo> future = arrow::Future<FlightInfo>::Make();

Expand All @@ -1903,7 +1905,10 @@ void AsyncClientTest::TestListenerLifetime() {
arrow::Future<FlightInfo> future_;
};

// Bad client code: don't retain a reference to the listener
// Bad client code: don't retain a reference to the listener, which owns the
// RPC state. We should still be able to get the result without crashing. (The
// RPC state is disposed of in the background via the 'garbage bin' in the
// gRPC client implementation.)
{
auto descr = FlightDescriptor::Command("my_command");
auto listener = std::make_shared<Listener>();
Expand Down
2 changes: 2 additions & 0 deletions cpp/src/arrow/flight/transport/grpc/grpc_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,8 @@ void InitializeFlightGrpcClient() {
});
}

#undef LISTENER_NOT_OK

} // namespace grpc
} // namespace transport
} // namespace flight
Expand Down

0 comments on commit e2738ac

Please sign in to comment.