Bug #76684 com.mysql.clusterj.ClusterJDatastoreException on get method clusterJ interface
Submitted: 14 Apr 2015 7:39 Modified: 14 Apr 2015 8:13
Reporter: Arco van der Velden Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Cluster: Cluster/J Severity:S1 (Critical)
Version:7.3.8 Win x64 OS:Microsoft Windows
Assigned to: Bogdan Kecman CPU Architecture:Any
Tags: ClusterJ, ClusterJDatastoreException, get

[14 Apr 2015 7:39] Arco van der Velden
Description:
I'm developing a java application using the clusterj api. 
The code below sometimes throws the following exception 
"com.mysql.clusterj.ClusterJDatastoreException: For field total column total valueDelegate object BigDecimal, error executing objectGetValue. Caused by java.lang.IllegalStateException:Current state = CODING_END, new state = FLUSHED" 
The exception is thrown by the positionsInterface.getTotal() statement. 
The code is running in multiple threads. 

PositionsInterface positionsInterface = session.find(PositionsInterface.class, id); 
if (positionsInterface == null) { 
//Insert 
positionsInterface = session.newInstance(PositionsInterface.class, id); 
positionsInterface.setTotal(amount); 
session.persist(positionsInterface); 
} 
else { 
//Update 
positionsInterface.setTotal(positionsInterface.getTotal().add(amount)); 
session.updatePersistent(positionsInterface); 
} 

How to repeat:
Try to get a value from a interface in a multithreaded Java environment.
[14 Apr 2015 8:13] Arco van der Velden
Full stack trace

com.mysql.clusterj.ClusterJDatastoreException: For field total column total valueDelegate object BigDecimal, error executing objectGetValue. Caused by java.lang.IllegalStateException:Current state = CODING_END, new state = FLUSHED
	at com.mysql.clusterj.core.metadata.AbstractDomainFieldHandlerImpl.objectGetValue(AbstractDomainFieldHandlerImpl.java:297)
	at com.mysql.clusterj.tie.NdbRecordSmartValueHandlerImpl.get(NdbRecordSmartValueHandlerImpl.java:715)
	at com.mysql.clusterj.tie.NdbRecordSmartValueHandlerImpl.invoke(NdbRecordSmartValueHandlerImpl.java:741)
	at com.mysql.clusterj.core.metadata.$Proxy12.getTotal(Unknown Source)
	at com.euroccp.tps.entities.facade.InstructionsFacade.updateRecordClusterJ(InstructionsFacade.java:66)
	at com.euroccp.tps.database.TPSDatabase.processTransAction(TPSDatabase.java:68)
	at com.euroccp.tps.threads.MySQLClusterJ.processCommand(MySQLClusterJ.java:61)
	at com.euroccp.tps.threads.MySQLClusterJ.run(MySQLClusterJ.java:48)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	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:744)
Caused by: java.lang.IllegalStateException: Current state = CODING_END, new state = FLUSHED
	at java.nio.charset.CharsetDecoder.throwIllegalStateException(CharsetDecoder.java:968)
	at java.nio.charset.CharsetDecoder.flush(CharsetDecoder.java:657)
	at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:786)
	at com.mysql.clusterj.tie.Utility.getDecimalString(Utility.java:1719)
	at com.mysql.clusterj.tie.Utility.getDecimal(Utility.java:1671)
	at com.mysql.clusterj.tie.NdbRecordImpl.getDecimal(NdbRecordImpl.java:543)
	at com.mysql.clusterj.tie.NdbRecordOperationImpl.getDecimal(NdbRecordOperationImpl.java:854)
	at com.mysql.clusterj.tie.NdbRecordSmartValueHandlerImpl.getBigDecimal(NdbRecordSmartValueHandlerImpl.java:210)
	at com.mysql.clusterj.core.metadata.AbstractDomainFieldHandlerImpl$10.objectGetValue(AbstractDomainFieldHandlerImpl.java:1249)
	at com.mysql.clusterj.core.metadata.AbstractDomainFieldHandlerImpl.objectGetValue(AbstractDomainFieldHandlerImpl.java:295)
	... 12 more
java.lang.IllegalStateException: Current state = CODING_END, new state = FLUSHED
	at java.nio.charset.CharsetDecoder.throwIllegalStateException(CharsetDecoder.java:968)
	at java.nio.charset.CharsetDecoder.flush(CharsetDecoder.java:657)
	at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:786)
	at com.mysql.clusterj.tie.Utility.getDecimalString(Utility.java:1719)
	at com.mysql.clusterj.tie.Utility.getDecimal(Utility.java:1671)
	at com.mysql.clusterj.tie.NdbRecordImpl.getDecimal(NdbRecordImpl.java:543)
	at com.mysql.clusterj.tie.NdbRecordOperationImpl.getDecimal(NdbRecordOperationImpl.java:854)
	at com.mysql.clusterj.tie.NdbRecordSmartValueHandlerImpl.getBigDecimal(NdbRecordSmartValueHandlerImpl.java:210)
	at com.mysql.clusterj.core.metadata.AbstractDomainFieldHandlerImpl$10.objectGetValue(AbstractDomainFieldHandlerImpl.java:1249)
	at com.mysql.clusterj.core.metadata.AbstractDomainFieldHandlerImpl.objectGetValue(AbstractDomainFieldHandlerImpl.java:295)
	at com.mysql.clusterj.tie.NdbRecordSmartValueHandlerImpl.get(NdbRecordSmartValueHandlerImpl.java:715)
	at com.mysql.clusterj.tie.NdbRecordSmartValueHandlerImpl.invoke(NdbRecordSmartValueHandlerImpl.java:741)
	at com.mysql.clusterj.core.metadata.$Proxy12.getTotal(Unknown Source)
	at com.euroccp.tps.entities.facade.InstructionsFacade.updateRecordClusterJ(InstructionsFacade.java:66)
	at com.euroccp.tps.database.TPSDatabase.processTransAction(TPSDatabase.java:68)
	at com.euroccp.tps.threads.MySQLClusterJ.processCommand(MySQLClusterJ.java:61)
	at com.euroccp.tps.threads.MySQLClusterJ.run(MySQLClusterJ.java:48)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	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:744)
apr 14, 2015