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 2020/11/11 04:34:58 UTC
[GitHub] [pulsar] merlimat opened a new pull request #8518: Fixed handling errors for client requests
merlimat opened a new pull request #8518:
URL: https://github.com/apache/pulsar/pull/8518
### Motivation
`ClientCnx` is maintaining different maps for different types of requests. The problem is that on `handleError()` it's only checking on the main map, the one containing requests for creating producers and consumers, but it's ignoring the error on other kind of requests.
For example, an error returned by broker on the `GetLastMessageId` request, will result in calls to `hasMessageAvailable()` to get stuck, since the error is ignored and the future never completed:
```
18:11:09.083 [pulsar-client-io-1-1:org.apache.pulsar.client.impl.ClientCnx@602] WARN org.apache.pulsar.client.impl.ClientCnx - [id: 0xa378924b, L:/127.0.0.1:58267 - R:localhost/127.0.0.1:6650] Received error from server: XXX
18:11:09.084 [pulsar-client-io-1-1:org.apache.pulsar.client.impl.ClientCnx@612] WARN org.apache.pulsar.client.impl.ClientCnx - [id: 0xa378924b, L:/127.0.0.1:58267 - R:localhost/127.0.0.1:6650] Received unknown request id from server: 3
```
### Modifications
There's no good reason to keep 1 map per kind of request. Instead, we should use a single map.
----------------------------------------------------------------
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
[GitHub] [pulsar] jerrypeng commented on a change in pull request #8518: Fixed handling errors for client requests
Posted by GitBox <gi...@apache.org>.
jerrypeng commented on a change in pull request #8518:
URL: https://github.com/apache/pulsar/pull/8518#discussion_r521133556
##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
##########
@@ -465,7 +443,7 @@ protected void handleGetLastMessageIdSuccess(CommandGetLastMessageIdResponse suc
log.debug("{} Received success GetLastMessageId response from server: {}", ctx.channel(), success.getRequestId());
}
long requestId = success.getRequestId();
- CompletableFuture<MessageIdData> requestFuture = pendingGetLastMessageIdRequests.remove(requestId);
+ CompletableFuture<MessageIdData> requestFuture = (CompletableFuture<MessageIdData>) pendingRequests.remove(requestId);
Review comment:
if there is a cast exception, shouldn't we handle it? If the client somehow is returned a wrong request id that is for a different request type, a cast exception may happen here. If it does, the requestFuture will never get completed and may cause the client api call to block forever.
----------------------------------------------------------------
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
[GitHub] [pulsar] jerrypeng commented on a change in pull request #8518: Fixed handling errors for client requests
Posted by GitBox <gi...@apache.org>.
jerrypeng commented on a change in pull request #8518:
URL: https://github.com/apache/pulsar/pull/8518#discussion_r521140055
##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
##########
@@ -465,7 +443,7 @@ protected void handleGetLastMessageIdSuccess(CommandGetLastMessageIdResponse suc
log.debug("{} Received success GetLastMessageId response from server: {}", ctx.channel(), success.getRequestId());
}
long requestId = success.getRequestId();
- CompletableFuture<MessageIdData> requestFuture = pendingGetLastMessageIdRequests.remove(requestId);
+ CompletableFuture<MessageIdData> requestFuture = (CompletableFuture<MessageIdData>) pendingRequests.remove(requestId);
Review comment:
i see
----------------------------------------------------------------
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
[GitHub] [pulsar] merlimat commented on a change in pull request #8518: Fixed handling errors for client requests
Posted by GitBox <gi...@apache.org>.
merlimat commented on a change in pull request #8518:
URL: https://github.com/apache/pulsar/pull/8518#discussion_r521138459
##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
##########
@@ -465,7 +443,7 @@ protected void handleGetLastMessageIdSuccess(CommandGetLastMessageIdResponse suc
log.debug("{} Received success GetLastMessageId response from server: {}", ctx.channel(), success.getRequestId());
}
long requestId = success.getRequestId();
- CompletableFuture<MessageIdData> requestFuture = pendingGetLastMessageIdRequests.remove(requestId);
+ CompletableFuture<MessageIdData> requestFuture = (CompletableFuture<MessageIdData>) pendingRequests.remove(requestId);
Review comment:
The connection will get automatically closed and therefore the future will be completed there.
----------------------------------------------------------------
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
[GitHub] [pulsar] sijie merged pull request #8518: Fixed handling errors for client requests
Posted by GitBox <gi...@apache.org>.
sijie merged pull request #8518:
URL: https://github.com/apache/pulsar/pull/8518
----------------------------------------------------------------
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
[GitHub] [pulsar] jerrypeng commented on a change in pull request #8518: Fixed handling errors for client requests
Posted by GitBox <gi...@apache.org>.
jerrypeng commented on a change in pull request #8518:
URL: https://github.com/apache/pulsar/pull/8518#discussion_r521133556
##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
##########
@@ -465,7 +443,7 @@ protected void handleGetLastMessageIdSuccess(CommandGetLastMessageIdResponse suc
log.debug("{} Received success GetLastMessageId response from server: {}", ctx.channel(), success.getRequestId());
}
long requestId = success.getRequestId();
- CompletableFuture<MessageIdData> requestFuture = pendingGetLastMessageIdRequests.remove(requestId);
+ CompletableFuture<MessageIdData> requestFuture = (CompletableFuture<MessageIdData>) pendingRequests.remove(requestId);
Review comment:
if there is a cast exception, shouldn't we handle it? If the client somehow is returned a wrong request id and causing cast exception here, I think the requestFuture will never get completed and may cause the client api call to block forever.
----------------------------------------------------------------
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
[GitHub] [pulsar] codelipenghui commented on pull request #8518: Fixed handling errors for client requests
Posted by GitBox <gi...@apache.org>.
codelipenghui commented on pull request #8518:
URL: https://github.com/apache/pulsar/pull/8518#issuecomment-725872054
cherry-picked to branch-2.6
----------------------------------------------------------------
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