Hi Team
We are exploring camunda for our use.
We have been assuming that TaskServiceImpl.getVariables() will be read only database operation, but looks like it is not. In certain cases, it is doing some data insertion into history table. Is there a reason its working this way? We would like understand it in detail so we can build better API on top of camunda.
Error that we receive because we are marking our operation as read only which calls TaskServiceImpl.getVariables.
“message”: "ENGINE-16004 Exception while closing command context: ENGINE-03004 Exception while executing Database Operation ‘INSERT HistoricVariableUpdateEventEntity[1b4dfebb-94e4-11e7-b60e-0242ac110002]’ with message ‘\n### Error updating database. Cause: java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed\n### The error may involve org.camunda.bpm.engine.impl.persistence.entity.HistoricDetailEntity.insertHistoricVariableUpdateEvent-Inline\n### The error occurred while setting parameters\n### SQL: insert into ACT_HI_DETAIL ( ID_, TYPE_, PROC_DEF_KEY_, PROC_DEF_ID_, PROC_INST_ID_, EXECUTION_ID_, ACT_INST_ID_, CASE_DEF_KEY_, CASE_DEF_ID_, CASE_INST_ID_, CASE_EXECUTION_ID_, TASK_ID_, NAME_, REV_, VAR_INST_ID_, VAR_TYPE_, TIME_, BYTEARRAY_ID_, DOUBLE_, LONG_, TEXT_, TEXT2_, SEQUENCE_COUNTER_, TENANT_ID_ ) values ( ?, ‘VariableUpdate’, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )\n### Cause: java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed’.
On debugging, found that it calls following API and tracks some changes across session and tries to insert data into history table to update its cache details. Why? Why would you do this operation as part of get call? I assume there might be background scheduler working which should actually do this job - updating the cache.
Any details provided around this behaviour will help us design and use camunda better.
Can there be any data issue in application which can be causing this issue?
DbOperationManager.getInsertsForType(Class, boolean) line: 103
DbOperationManager.addOperation(DbEntityOperation) line: 67
DbEntityManager.performEntityOperation(CachedDbEntity, DbOperationType) line: 447
DbEntityManager.flushCachedEntity(CachedDbEntity) line: 347
DbEntityManager.flushEntityCache() line: 334
DbEntityManager.flush() line: 275
CommandContext.flushSessions() line: 247
CommandContext.close(CommandInvocationContext) line: 176
CommandContextInterceptor.execute(Command) line: 113
SpringTransactionInterceptor$1.doInTransaction(TransactionStatus) line: 42
TransactionTemplate.execute(TransactionCallback) line: 133
SpringTransactionInterceptor.execute(Command) line: 40
ProcessApplicationContextInterceptor.execute(Command) line: 66
LogInterceptor.execute(Command) line: 30
TaskServiceImpl.getVariablesTyped(String, boolean) line: 206
TaskServiceImpl.getVariablesTyped(String) line: 202
TaskServiceImpl.getVariables(String) line: 198
TaskServiceImpl.getVariables(String) line: 79
Thanks