You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/06/02 20:37:21 UTC

[GitHub] [pulsar] merlimat commented on a change in pull request #10775: Run code to respond to auth challenge in a different thread in the pulsar client

merlimat commented on a change in pull request #10775:
URL: https://github.com/apache/pulsar/pull/10775#discussion_r644303009



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
##########
@@ -330,48 +331,54 @@ protected void handleAuthChallenge(CommandAuthChallenge authChallenge) {
         checkArgument(authChallenge.hasChallenge());
         checkArgument(authChallenge.getChallenge().hasAuthData());
 
-        if (Arrays.equals(AuthData.REFRESH_AUTH_DATA_BYTES, authChallenge.getChallenge().getAuthData())) {
-            try {
-                authenticationDataProvider = authentication.getAuthData(remoteHostName);
-            } catch (PulsarClientException e) {
-                log.error("{} Error when refreshing authentication data provider: {}", ctx.channel(), e);
-                connectionFuture.completeExceptionally(e);
-                return;
+        // Run this the code to respond to the authentication challenge in another thread so we are not potentially
+        // blocking a pulsar-client-io thread.  A portion of the code is user supplied, such as getting a token, which is another
+        // reason to run in a separate thread so user code cannot not block pulsar-client-io thread. Potential blocking code
+        // will also render send timeouts to be not respected since it uses pulsar-client-io thread as well.
+        CompletableFuture.runAsync(() -> {

Review comment:
       This will be running from the ForkJoinPool and we don't really know what is running there. We should try to use the internal client executor.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org