Hi there,
we had several occurences for a setVariables
-action created additional variable instances of the same name for a single process. I always assumed there is only one instance allowed which will continiously change as documented in ACT_HI_DETAIL table.
Does anyone know whether my assumption is valid or not? Also, either way, any references or background information would be greatly appreciated!
Kind regards
Adagatiya
Hello my friend! Welcome again! \o/
In theory, when using setVariable
it creates the variable with the specified name, and when it is used again with the same variable name, the value is overwritten within Camunda, but in the ACT_HI_DETAIL table, it shows a breakdown of each variable in the process, so you can check the exact moment the variable was created, and every moment it is updated.
History tables really become GIANT in a short time, for this reason it is not recommended to keep the default history storage (FULL) in Camunda, but to set it according to your needs.
I hope this helps!
William Robert Alves
Thank you for the repsonse, @WilliamR.Alves .
The behaviour you described, matches what I thought.
So, would I be correct, when it is a bug inside camunda when two variable instances are created for a single variable within the same process? Or are there constellations where it is allowed?
I am trying to figure out wether our software should handle these cases or we have to fix it within the camunda code.
Kind regards
Adagatiya
Hi @Adagatiya,
It is allowed to have several variables with the same name on a process instance when they are on different scopes.
See Process Variables | docs.camunda.org for further details.
Hope this helps, Ingo
2 Likes
Hello! In fact, if they are not within the same process, it is allowed, and it is normal!
But within ONE SINGLE process, it cannot.
You can have a variable named “myVariable” in the main process, and another with the same name in another process or subprocess, but never within the same process, this is related to scopes, and works basically the same way as variables of scope in a programming language like Java for example.
William Robert Alves
Hi @Ingo_Richtsmeier and @WilliamR.Alves ,
multiple variable instances are created on a non-reproducible pattern thus far. And we can say that it happens independently from any subprocesses involved. Also, I am pretty sure that we do not use local variables.
Regarding variable scopes, is there a way to check it from database side? All entries of the variable instances are the same except for create time and value. For all occurences the creation time of these instances was within a very tight time range being less than a second.
Kind regards
Adagatiya
@Adagatiya,
Do you want to share an image of the variables in your cockpit to better illustrate?
William Robert Alves
Hi,
sadly I can not provide an image of the cockpit right now, we manually cleaned up those proceses.Also, when this error occurred, we just had a look into the database. So I can not say whether the cockpit would have shown the duplicate.
Kind regards
Adagatiya