insert into ACT_RU_VARIABLE failing with java.lang.IllegalArgumentException: NaN

cancel
Showing results for 
Search instead for 
Did you mean: 
espe
Member II

insert into ACT_RU_VARIABLE failing with java.lang.IllegalArgumentException: NaN

Hello,

I have a pretty much big process with approximately 1.000 steps. When I start the process I get the following exception:

org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: java.lang.IllegalArgumentException: NaN
### The error may involve org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.insertVariableInstance-Inline
### The error occurred while setting parameters
### SQL: insert into ACT_RU_VARIABLE (ID_, REV_, TYPE_, NAME_, PROC_INST_ID_, EXECUTION_ID_, TASK_ID_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT_, TEXT2_) values ( ?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: java.lang.IllegalArgumentException: NaN
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:150)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:137)
at org.activiti.engine.impl.db.DbSqlSession.flushInserts(DbSqlSession.java:761)
at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:593)
Truncated. see log file for complete stacktrace
Caused By: java.lang.IllegalArgumentException: NaN
at oracle.jdbc.driver.OraclePreparedStatement.setDoubleInternal(OraclePreparedStatement.java:6599)
at oracle.jdbc.driver.OraclePreparedStatement.setDouble(OraclePreparedStatement.java:6574)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.setDouble(OraclePreparedStatementWrapper.java:193)
at org.apache.ibatis.type.DoubleTypeHandler.setNonNullParameter(DoubleTypeHandler.java:28)
at org.apache.ibatis.type.DoubleTypeHandler.setNonNullParameter(DoubleTypeHandler.java:23)
Truncated. see log file for complete stacktrace

Now, the interesting part is that it fails randomly. It can fail on step 2, or even step 999. It can even complete the whole process successfully and then fail after it has completed. I can assure you that the data remain exactly the same between different executions.

The process consists exclusively of service tasks (no human actors) which perform some calculations. So the result variables which are stored in activiti variables are mainly numbers or arrays of numbers (which can reach large sizes - e.g. 8.000).

I am working with Activiti version 5.17.0 on an Oracle 12c database.

Any ideas? I am thinking of performance issues. I make a calculation, then Activiti takes too much time to write the result into the database but the next step tries to retrieve the same value. Are steps being executed sequentially? For sure I am not using any parallelism components (split and join etc)

3 Replies
daisuke-yoshimo
Senior Member

Re: insert into ACT_RU_VARIABLE failing with java.lang.IllegalArgumentException: NaN

The cause of this error is that the query of variables has exceeded the Oracle Database limit that IN Clause 1000 item limit.
If we use Oracle Database, we cannnot use IN Clause more than 1000 item.

> So the result variables which are stored in activiti variables are mainly numbers or arrays of numbers (which can reach large sizes - e.g. 8.000).
> I am working with Activiti version 5.17.0 on an Oracle 12c database.
> ### SQL: insert into ACT_RU_VARIABLE (ID_, REV_, TYPE_, NAME_, PROC_INST_ID_, EXECUTION_ID_, TASK_ID_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT_, TEXT2_) values ( ?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
> ### Cause: java.lang.IllegalArgumentException: NaN
> at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)

The solution is that you reduce the number of variables of process.

The field not used for search should be stored as individual variables.
The field not used for search should be aggregated into one variable as binary variable type such as java.util.Map.

espe
Member II

Re: insert into ACT_RU_VARIABLE failing with java.lang.IllegalArgumentException: NaN

Thanks for your answer.

Even if I wanted to agree with you..

1) I haven't read any limitation about the number of process variables that activiti can handle.

2) Why it happens randomly? Why sometimes the process just finishes ok? 

bassam_al-saror
Alfresco Employee

Re: insert into ACT_RU_VARIABLE failing with java.lang.IllegalArgumentException: NaN

Seems from the trace you provided that there is an issue with a double value 

Caused By: java.lang.IllegalArgumentException: NaN
at oracle.jdbc.driver.OraclePreparedStatement.setDoubleInternal(OraclePreparedStatement.java:6599)
at oracle.jdbc.driver.OraclePreparedStatement.setDouble(OraclePreparedStatement.java:6574)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.setDouble(OraclePreparedStatementWrapper.java:193)
at org.apache.ibatis.type.DoubleTypeHandler.setNonNullParameter(DoubleTypeHandler.java:28)
at org.apache.ibatis.type.DoubleTypeHandler.setNonNullParameter(DoubleTypeHandler.java:23)

It's hard to understand the issue if there is no way to reproduce it. Can you try to reproduce using a simpler process definition? I would also recommend you to try the latest activiti version (currently either version 6 or 5.22).