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

QueryableEntry.serializationService is null when MapReduce is run with Extractable entries #8346

Closed
alparslanavci opened this issue Jun 8, 2016 · 1 comment

Comments

Projects
None yet
3 participants
@alparslanavci
Copy link

commented Jun 8, 2016

Hazelcast version is 3.6.3.

If we try to run MapReduce with Extractable entries, a NullPointerException is thrown with the stacktrace below:

Exception in thread "main" com.hazelcast.core.HazelcastException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
    at com.hazelcast.map.impl.proxy.MapProxyImpl.aggregate(MapProxyImpl.java:763)
    at com.hazelcast.map.impl.proxy.MapProxyImpl.aggregate(MapProxyImpl.java:734)
    at FXPBFeesPOC.main(FXPBFeesPOC.java:163)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
    at com.hazelcast.mapreduce.impl.task.TrackableJobFuture.setResult(TrackableJobFuture.java:68)
    at com.hazelcast.mapreduce.impl.task.JobSupervisor.notifyRemoteException(JobSupervisor.java:156)
    at com.hazelcast.mapreduce.impl.MapReduceUtil.notifyRemoteException(MapReduceUtil.java:86)
    at com.hazelcast.mapreduce.impl.task.MapCombineTask.handleProcessorThrowable(MapCombineTask.java:293)
    at com.hazelcast.mapreduce.impl.task.MapCombineTask.access$500(MapCombineTask.java:68)
    at com.hazelcast.mapreduce.impl.task.MapCombineTask$PartitionBasedProcessor.processPartitions(MapCombineTask.java:358)
    at com.hazelcast.mapreduce.impl.task.MapCombineTask$PartitionBasedProcessor.run(MapCombineTask.java:333)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at com.hazelcast.util.executor.CompletableFutureTask.run(CompletableFutureTask.java:67)
    at com.hazelcast.util.executor.CachedExecutorServiceDelegate$Worker.run(CachedExecutorServiceDelegate.java:212)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
    at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:76)
    at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:92)
Caused by: java.lang.NullPointerException
    at com.hazelcast.query.impl.getters.Extractors.getTargetObject(Extractors.java:80)
    at com.hazelcast.query.impl.getters.Extractors.extract(Extractors.java:62)
    at com.hazelcast.query.impl.QueryableEntry.extractAttributeValueFromTargetObject(QueryableEntry.java:144)
    at com.hazelcast.query.impl.QueryableEntry.extractAttributeValue(QueryableEntry.java:82)
    at com.hazelcast.query.impl.QueryableEntry.getAttributeValue(QueryableEntry.java:48)
    at com.hazelcast.query.impl.predicates.AbstractPredicate.readAttributeValue(AbstractPredicate.java:130)
    at com.hazelcast.query.impl.predicates.AbstractPredicate.apply(AbstractPredicate.java:55)
    at com.hazelcast.mapreduce.aggregation.impl.PredicateSupplier.apply(PredicateSupplier.java:58)
    at com.hazelcast.mapreduce.aggregation.impl.SupplierConsumingMapper.map(SupplierConsumingMapper.java:60)
    at com.hazelcast.mapreduce.impl.task.KeyValueSourceMappingPhase.executeMappingPhase(KeyValueSourceMappingPhase.java:49)
    at com.hazelcast.mapreduce.impl.task.MapCombineTask.processMapping(MapCombineTask.java:135)
    at com.hazelcast.mapreduce.impl.task.MapCombineTask.processPartitionMapping(MapCombineTask.java:304)
    at com.hazelcast.mapreduce.impl.task.MapCombineTask.access$700(MapCombineTask.java:68)
    at com.hazelcast.mapreduce.impl.task.MapCombineTask$PartitionBasedProcessor.processPartitions(MapCombineTask.java:356)
    at com.hazelcast.mapreduce.impl.task.MapCombineTask$PartitionBasedProcessor.run(MapCombineTask.java:333)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at com.hazelcast.util.executor.CompletableFutureTask.run(CompletableFutureTask.java:67)
    at com.hazelcast.util.executor.CachedExecutorServiceDelegate$Worker.run(CachedExecutorServiceDelegate.java:212)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
    at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:76)
    at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:92)
    at ------ End remote and begin local stack-trace ------.(Unknown Source)
    at ------ Operation failed on node: Address[192.168.2.74]:5721 ------.notifyRemoteException(JobSupervisor.java:154)
    at com.hazelcast.mapreduce.impl.task.JobSupervisor.notifyRemoteException(JobSupervisor.java:154)
    ... 13 more
@alparslanavci

This comment has been minimized.

Copy link
Author

commented Jun 8, 2016

Here is a simple reproducer for the case:

public class NPEReproducer {
    public static void main(String[] args) {
        Config config = new Config();
        config.getSerializationConfig().addPortableFactory(1, new FooPortableFactory());
        HazelcastInstance hazelcastInstance = Hazelcast.newHazelcastInstance(config);

        IMap<Integer, Foo> fooMap = hazelcastInstance.getMap("fooMap");
        Foo value = new Foo();
        value.text = "foo";
        fooMap.put(1, value);

        final Supplier<Integer, Foo, Integer> supplier = Supplier.fromPredicate(Predicates.equal("text", "foo"));

        final Aggregation<Integer, Integer, Long> counter = Aggregations.count();

        Long count = fooMap.aggregate(supplier, counter);

        System.out.println("Count: " + count);
    }

    private static class FooPortableFactory implements PortableFactory {
        public Portable create(int classId) {
            if (Foo.ID == classId){
                return new Foo();
            }else {
                return null;
            }
        }
    }

    private static class Foo implements Portable{
        public static final int ID = 1;
        String text;

        public int getFactoryId() {
            return 1;
        }

        public int getClassId() {
            return ID;
        }

        public void writePortable(PortableWriter writer) throws IOException {
            writer.writeUTF("text", text);
        }

        public void readPortable(PortableReader reader) throws IOException {
            text = reader.readUTF("text");
        }
    }
}

@tombujok tombujok self-assigned this Jun 13, 2016

tombujok added a commit that referenced this issue Jun 14, 2016

Merge pull request #8368 from tombujok/github-8346
MapReduce Mapping phase NPE fixed for Portable data format. Fixes #8346

@tombujok tombujok added this to the 3.7 milestone Jun 14, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.