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

NullPointerException in LockServiceImpl #9792

Closed
Donnerbart opened this issue Feb 1, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@Donnerbart
Copy link
Contributor

commented Feb 1, 2017

We can produce a NPE in LockServiceImpl by creating one map with a quorum configuration (which activates the QuorumServiceImpl for all QuorumAware operations) and then call an QuorumAware operation on another data structure without a quorum configuration:

java.lang.NullPointerException
	at java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
	at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
	at com.hazelcast.util.ConcurrencyUtil.getOrPutSynchronized(ConcurrencyUtil.java:94)
	at com.hazelcast.concurrent.lock.LockServiceImpl.getQuorumName(LockServiceImpl.java:336)
	at com.hazelcast.quorum.impl.QuorumServiceImpl.findQuorum(QuorumServiceImpl.java:144)
	at com.hazelcast.quorum.impl.QuorumServiceImpl.ensureQuorumPresent(QuorumServiceImpl.java:123)
	at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.ensureQuorumPresent(OperationRunnerImpl.java:237)
	at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.run(OperationRunnerImpl.java:178)
	at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.run(OperationRunnerImpl.java:401)
	at com.hazelcast.spi.impl.operationexecutor.impl.OperationThread.process(OperationThread.java:117)
	at com.hazelcast.spi.impl.operationexecutor.impl.OperationThread.run(OperationThread.java:102)
	at ------ submitted from ------.(Unknown Source)
	at com.hazelcast.spi.impl.operationservice.impl.InvocationFuture.resolve(InvocationFuture.java:114)
	at com.hazelcast.spi.impl.operationservice.impl.InvocationFuture.resolveAndThrowIfException(InvocationFuture.java:75)
	at com.hazelcast.spi.impl.AbstractInvocationFuture.get(AbstractInvocationFuture.java:155)
	at com.hazelcast.spi.impl.AbstractInvocationFuture.join(AbstractInvocationFuture.java:136)
	at com.hazelcast.concurrent.lock.LockProxySupport.unlock(LockProxySupport.java:149)
	at com.hazelcast.concurrent.lock.LockProxy.unlock(LockProxy.java:106)
	at com.hazelcast.quorum.QuorumTest.oneQuorumShouldNotAffectQuorumAwareOperationsOnDataStructuresWithoutQuorumConfiguration(QuorumTest.java:307)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at com.hazelcast.test.FailOnTimeoutStatement$CallableStatement.call(FailOnTimeoutStatement.java:89)
	at com.hazelcast.test.FailOnTimeoutStatement$CallableStatement.call(FailOnTimeoutStatement.java:81)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.lang.Thread.run(Thread.java:745)

The reason is the LockConfig lockConfig = nodeEngine.getConfig().findLockConfig(name) which returns the default configuration for non-quorum data structures, which has null as quorum name. This null is then put into the ConcurrentMap<String, String> quorumConfigCache which produces the NPE.

@Donnerbart Donnerbart added this to the 3.8 milestone Feb 1, 2017

@Donnerbart Donnerbart self-assigned this Feb 1, 2017

@Donnerbart

This comment has been minimized.

Copy link
Contributor Author

commented Feb 1, 2017

Fixed via 98c61b1 (sorry, forget to create a branch for a PR)

@Donnerbart Donnerbart closed this Feb 1, 2017

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.