tillrohrmann commented on a change in pull request #6876: [FLINK-10251] Handle
oversized response messages in AkkaRpcActor
URL: https://github.com/apache/flink/pull/6876#discussion_r248237741
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaInvocationHandler.java
##########
@@ -205,12 +207,34 @@ private Object invokeRpc(Method method, Object[] args)
throws Exception {
result = null;
} else if (Objects.equals(returnType, CompletableFuture.class))
{
// execute an asynchronous call
- result = ask(rpcInvocation, futureTimeout);
+ CompletableFuture resultFuture = ask(rpcInvocation,
futureTimeout);
+
+ result = resultFuture.thenApply((Object o) -> {
+ if (o instanceof SerializedValue) {
+ try {
+ return ((SerializedValue)
o).deserializeValue(getClass().getClassLoader());
+ } catch (IOException |
ClassNotFoundException e) {
+ throw new
CompletionException(e);
+ }
+ } else {
+ return o;
+ }
+ });
} else {
// execute a synchronous call
- CompletableFuture<?> futureResult = ask(rpcInvocation,
futureTimeout);
+ CompletableFuture<?> resultFuture = ask(rpcInvocation,
futureTimeout);
- result = futureResult.get(futureTimeout.getSize(),
futureTimeout.getUnit());
+ Object returnedResult =
resultFuture.get(futureTimeout.getSize(), futureTimeout.getUnit());
+
+ if (returnedResult instanceof SerializedValue) {
+ try {
+ result = ((SerializedValue)
returnedResult).deserializeValue(getClass().getClassLoader());
+ } catch (IOException | ClassNotFoundException
e) {
+ throw new CompletionException(e);
Review comment:
This should not be a `CompletionException`. Instead I would throw a
`RpcException` saying that one could not deserialize a serialized payload.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services