Inserting a variable with the same name on the same process-instance from 2 threads results in duplicate name/revision entry in ACT_RU_VARIABLE. It also causes the process-instance to be "undeleteble", as only one of the 2 variable instances will be deleted due to the fact they are kept in-memory in a map, using the name as the key. Same goes for setting task-variables.
No optimistic locking is done, since the variables are both new inserts + no unique index on the var name/revision/procinstId/taskId is present to prevent these duplicates on a DB-mevel. This only occurs when the transactions are almost simultaneous, but should be fixed.