Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExecutionCallback is never called on client in case of failed result serialization. #13639

Closed
asentsov opened this issue Aug 26, 2018 · 1 comment
Closed

Comments

@asentsov
Copy link

@asentsov asentsov commented Aug 26, 2018

  • Hazelcast 3.10
  • One node
  • One client
  • java version "1.8.0_181"
    Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
  • Ubuntu 16.04

Hi. onFailure() is never called if result can't be serialized.

import com.hazelcast.client.*;
import com.hazelcast.core.*;

import java.io.*;
import java.util.concurrent.*;

public class TestFailedCallback {

    public static void main(String[] args) {
        Hazelcast.newHazelcastInstance();
        final HazelcastInstance hazelcastClientInstance = HazelcastClient.newHazelcastClient();
        final IExecutorService executorService = hazelcastClientInstance.getExecutorService("any");

        CompletableFuture<Object> future = new CompletableFuture<>();

        try{
            executorService
                    .submit(new FailedTask(), new ExecutionCallback<Object>() {
                        @Override
                        public void onResponse(Object response) {
                            System.out.println("TestFailedCallback.onResponse IS NEVER CALLED");
                            future.complete(response);
                        }

                        @Override
                        public void onFailure(Throwable t) {
                            System.out.println("TestFailedCallback.onFailure IS NEVER CALLED");
                            future.completeExceptionally(t);
                        }
                    });

            try {
                future.get();
            } catch (Exception e) {
                System.out.println(e.toString());
            }
        } catch (Exception e){
            System.out.println(e.toString());
        }

        System.out.println("This is never called");
    }

    private static class FailedTask implements Callable, Serializable {
        @Override
        public Object call() throws Exception {
            System.out.println("FailedTask is started on :" + Thread.currentThread().getName());
            return new Object();
        }
    }
}
Exception in thread "hz._hzInstance_1_dev.cached.thread-2" com.hazelcast.nio.serialization.HazelcastSerializationException: Failed to serialize 'java.lang.Object'
        at com.hazelcast.internal.serialization.impl.SerializationUtil.handleSerializeException(SerializationUtil.java:75)
        at com.hazelcast.internal.serialization.impl.AbstractSerializationService.toBytes(AbstractSerializationService.java:161)
        at com.hazelcast.internal.serialization.impl.AbstractSerializationService.toBytes(AbstractSerializationService.java:133)
        at com.hazelcast.spi.impl.operationservice.impl.OutboundResponseHandler.toNormalResponsePacket(OutboundResponseHandler.java:156)
        at com.hazelcast.spi.impl.operationservice.impl.OutboundResponseHandler.sendNormalResponse(OutboundResponseHandler.java:128)
        at com.hazelcast.spi.impl.operationservice.impl.OutboundResponseHandler.sendResponse(OutboundResponseHandler.java:103)
        at com.hazelcast.spi.Operation.sendResponse(Operation.java:416)
        at com.hazelcast.executor.impl.DistributedExecutorService$CallableProcessor.sendResponse(DistributedExecutorService.java:312)
        at com.hazelcast.executor.impl.DistributedExecutorService$CallableProcessor.run(DistributedExecutorService.java:296)
        at com.hazelcast.util.executor.CachedExecutorServiceDelegate$Worker.run(CachedExecutorServiceDelegate.java:227)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
        at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:64)
        at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:80)
@mmedenjak mmedenjak added this to the 3.11 milestone Aug 27, 2018
@sancar sancar self-assigned this Sep 7, 2018
sancar added a commit to sancar/hazelcast that referenced this issue Sep 7, 2018
When an unserializableResponse is trying to be send to client as response
from executor service tasks, the exception was logged on the server side,
and there was no response returned back to the client.

This pr, removes the logging in such case and sends related expcetion,
(HazelcastSerializationException) to the client.

Similar behaviour is also tested for the core side and verified it
already works as expected.

fixes hazelcast#13639
sancar added a commit to sancar/hazelcast that referenced this issue Sep 17, 2018
When an unserializableResponse is trying to be send to client as response
from executor service tasks, the exception was logged on the server side,
and there was no response returned back to the client.

This pr, removes the logging in such case and sends related expcetion,
(HazelcastSerializationException) to the client.

Similar behaviour is also tested for the core side and verified it
already works as expected.

fixes hazelcast#13639
sancar added a commit to sancar/hazelcast that referenced this issue Sep 17, 2018
When an unserializableResponse is trying to be send to client as response
from executor service tasks, the exception was logged on the server side,
and there was no response returned back to the client.

This pr, removes the logging in such case and sends related expcetion,
(HazelcastSerializationException) to the client.

Similar behaviour is also tested for the core side and verified it
already works as expected.

fixes hazelcast#13639

(cherry picked from commit 8fbdc58)
sancar added a commit to sancar/hazelcast that referenced this issue Sep 17, 2018
When an unserializableResponse is trying to be send to client as response
from executor service tasks, the exception was logged on the server side,
and there was no response returned back to the client.

This pr, removes the logging in such case and sends related expcetion,
(HazelcastSerializationException) to the client.

Similar behaviour is also tested for the core side and verified it
already works as expected.

fixes hazelcast#13639
sancar added a commit to sancar/hazelcast that referenced this issue Sep 17, 2018
When an unserializableResponse is trying to be send to client as response
from executor service tasks, the exception was logged on the server side,
and there was no response returned back to the client.

This pr, removes the logging in such case and sends related expcetion,
(HazelcastSerializationException) to the client.

Similar behaviour is also tested for the core side and verified it
already works as expected.

fixes hazelcast#13639

(cherry picked from commit 8fbdc58)
sancar added a commit to sancar/hazelcast that referenced this issue Sep 17, 2018
When an unserializableResponse is trying to be send to client as response
from executor service tasks, the exception was logged on the server side,
and there was no response returned back to the client.

This pr, removes the logging in such case and sends related expcetion,
(HazelcastSerializationException) to the client.

Similar behaviour is also tested for the core side and verified it
already works as expected.

fixes hazelcast#13639
sancar added a commit to sancar/hazelcast that referenced this issue Sep 17, 2018
When an unserializableResponse is trying to be send to client as response
from executor service tasks, the exception was logged on the server side,
and there was no response returned back to the client.

This pr, removes the logging in such case and sends related expcetion,
(HazelcastSerializationException) to the client.

Similar behaviour is also tested for the core side and verified it
already works as expected.

fixes hazelcast#13639

(cherry picked from commit 8fbdc58)
sancar added a commit to sancar/hazelcast that referenced this issue Sep 17, 2018
When an unserializableResponse is trying to be send to client as response
from executor service tasks, the exception was logged on the server side,
and there was no response returned back to the client.

This pr, removes the logging in such case and sends related expcetion,
(HazelcastSerializationException) to the client.

Similar behaviour is also tested for the core side and verified it
already works as expected.

fixes hazelcast#13639

(cherry picked from commit 8fbdc58)
sancar added a commit to sancar/hazelcast that referenced this issue Sep 17, 2018
When an unserializableResponse is trying to be send to client as response
from executor service tasks, the exception was logged on the server side,
and there was no response returned back to the client.

This pr, removes the logging in such case and sends related expcetion,
(HazelcastSerializationException) to the client.

Similar behaviour is also tested for the core side and verified it
already works as expected.

fixes hazelcast#13639
@asentsov
Copy link
Author

@asentsov asentsov commented Oct 26, 2018

@sancar, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.