Given:
I run Optimize 3.1.0 and there are process instances that have incidents (which are not imported in 3.1.0)
When:
I upgrade from Optimize 3.1.0 to 3.2.0
AND I start Optimize 3.2.0 and the Open Incident import runs
Then:
It fails and retries endlessly due to a NPE
[617]: index [optimize-process-instance_v5], type [_doc], id [c66b2be0-089a-11eb-a303-6e208305ef92], message [ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=failed to execute script]]; nested: ElasticsearchException[Elasticsearch exception [type=script_exception, reason=runtime error]]; nested: ElasticsearchException[Elasticsearch exception [type=null_pointer_exception, reason=null]];] [618]: index [optimize-process-instance_v5], type [_doc], id [851375be-089b-11eb-a303-6e208305ef92], message [ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=failed to execute script]]; nested: ElasticsearchException[Elasticsearch exception [type=script_exception, reason=runtime error]]; nested: ElasticsearchException[Elasticsearch exception [type=null_pointer_exception, reason=null]];] at org.camunda.optimize.service.es.writer.ElasticsearchWriterUtil.doBulkRequest(ElasticsearchWriterUtil.java:257) at org.camunda.optimize.service.es.writer.ElasticsearchWriterUtil.lambda$executeImportRequestsAsBulk$3(ElasticsearchWriterUtil.java:155) at java.util.HashMap.forEach(HashMap.java:1289) at org.camunda.optimize.service.es.writer.ElasticsearchWriterUtil.executeImportRequestsAsBulk(ElasticsearchWriterUtil.java:135) at org.camunda.optimize.service.es.job.importing.CompletedIncidentElasticsearchImportJob.persistEntities(CompletedIncidentElasticsearchImportJob.java:31) at org.camunda.optimize.service.es.job.ElasticsearchImportJob.executeImport(ElasticsearchImportJob.java:56) at org.camunda.optimize.service.es.job.ElasticsearchImportJob.run(ElasticsearchImportJob.java:37) 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)
Expected:
it should succeed importing incidents
Hint:
The cause seems likely to be that the incidents field of the procesInstance documents is not initialized during the upgrade and that the upsert scripts in OpenIncidentWriter tries to stream the field contents def existingIncidentsById = ctx._source.incidents.stream(