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/30 09:31:00 UTC

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

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



##########
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:
       +1 to @merlimat suggestion.
   we have not control over the internal JVM ForkJoinPool




-- 
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: commits-unsubscribe@pulsar.apache.org

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