Arawoof06 commented on code in PR #1506:
URL: https://github.com/apache/arrow-java/pull/1506#discussion_r4705214208


##########
flight/flight-core/src/main/java/org/apache/arrow/flight/auth/ClientAuthWrapper.java:
##########
@@ -84,15 +87,17 @@ public void onNext(HandshakeResponse value) {
 
           @Override
           public byte[] next() {
-            while (!completed.isDone() || !messages.isEmpty()) {
-              byte[] bytes = messages.poll();
-              if (bytes == null) {
-                // busy wait.
-                continue;
-              } else {
-                return bytes;
-              }
+            final byte[] bytes;
+            try {
+              bytes = messages.take();
+            } catch (InterruptedException e) {

Review Comment:
   Good catch. next() now calls sender.onError(e) before it rethrows, so the 
request stream is errored and the server sees onError and stops waiting on the 
queue.
   
   Added TestBasicAuth.interruptedClientHandshakeEndsServerStream for it: it 
waits until the server is parked in ServerAuthWrapper.next, interrupts the 
client mid-handshake, and checks the server thread leaves next(). Without the 
onError call it fails with the server still blocked.



-- 
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]

Reply via email to