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

TransactionalMapProxySupport fails for enabled NearCache #13371

Closed
kwart opened this issue Jun 27, 2018 · 1 comment
Closed

TransactionalMapProxySupport fails for enabled NearCache #13371

kwart opened this issue Jun 27, 2018 · 1 comment

Comments

@kwart
Copy link
Collaborator

@kwart kwart commented Jun 27, 2018

This issue was originally reported as a StackOverflow question. Thanks, peter stiles.

When a NearCache is used for an IMap and a TransactionalMap is used on client then get(key) operation fails reporting a wrong key type.

Reproducer:

String testName = "test";
Config config = new Config();
config.getMapConfig(testName).setNearCacheConfig(new NearCacheConfig());
try {
    Hazelcast.newHazelcastInstance(config);
    HazelcastInstance client = HazelcastClient.newHazelcastClient();

    TransactionContext context = client.newTransactionContext();
    context.beginTransaction();
    try {
        System.out.println(context.getMap(testName).get(testName));
        context.commitTransaction();
    } catch (Throwable t) {
        t.printStackTrace();
        context.rollbackTransaction();
    }
} finally {
    HazelcastInstanceFactory.terminateAll();
    HazelcastClient.shutdownAll();
}

Output:

java.lang.IllegalArgumentException: key cannot be of type Data!
	at com.hazelcast.util.Preconditions.checkNotInstanceOf(Preconditions.java:300)
	at com.hazelcast.internal.nearcache.impl.DefaultNearCache.checkKeyFormat(DefaultNearCache.java:234)
	at com.hazelcast.internal.nearcache.impl.DefaultNearCache.get(DefaultNearCache.java:114)
	at com.hazelcast.map.impl.tx.TransactionalMapProxySupport.getCachedValue(TransactionalMapProxySupport.java:178)
	at com.hazelcast.map.impl.tx.TransactionalMapProxySupport.getInternal(TransactionalMapProxySupport.java:130)
	at com.hazelcast.map.impl.tx.TransactionalMapProxy.get(TransactionalMapProxy.java:110)
	at com.hazelcast.client.impl.protocol.task.transactionalmap.TransactionalMapGetMessageTask.innerCall(TransactionalMapGetMessageTask.java:43)
	at com.hazelcast.client.impl.protocol.task.AbstractTransactionalMessageTask.call(AbstractTransactionalMessageTask.java:34)
	at com.hazelcast.client.impl.protocol.task.AbstractCallableMessageTask.processMessage(AbstractCallableMessageTask.java:35)
	at com.hazelcast.client.impl.protocol.task.AbstractMessageTask.initializeAndProcessMessage(AbstractMessageTask.java:123)
	at com.hazelcast.client.impl.protocol.task.AbstractMessageTask.doRun(AbstractMessageTask.java:111)
	at com.hazelcast.client.impl.protocol.task.AbstractMessageTask.run(AbstractMessageTask.java:101)
	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)
	at ------ submitted from ------.(Unknown Source)
	at com.hazelcast.client.spi.impl.ClientInvocationFuture.resolveAndThrowIfException(ClientInvocationFuture.java:96)
	at com.hazelcast.client.spi.impl.ClientInvocationFuture.resolveAndThrowIfException(ClientInvocationFuture.java:33)
	at com.hazelcast.spi.impl.AbstractInvocationFuture.get(AbstractInvocationFuture.java:162)
	at com.hazelcast.client.proxy.txn.ClientTransactionUtil.invoke(ClientTransactionUtil.java:57)
	at com.hazelcast.client.proxy.txn.ClientTxnProxy.invoke(ClientTxnProxy.java:61)
	at com.hazelcast.client.proxy.txn.ClientTxnMapProxy.get(ClientTxnMapProxy.java:80)
	at test.App.main(App.java:30)
@kwart kwart added this to the 3.11 milestone Jun 27, 2018
@Donnerbart Donnerbart self-assigned this Jun 27, 2018
@Donnerbart
Copy link
Contributor

@Donnerbart Donnerbart commented Jun 27, 2018

Uh, nice finding. I'll have a look what kind of test is missing there.

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.

4 participants