-
-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiled JQ in not execution safe for constant mutable structs #235
Comments
I can't understand this issue. Can you provide some problematic code? |
Yes, maybe I also did not explain in the best way. prog1.jq: Outputs to the same memory location between executions: prog2.jq Outputs different memory locations between executions: I would assume, prog1 have the same behavior as prog2 in the output |
Okay, I'd like to know how you use the library. In what use case the current behavior causes problems? |
I'm implementing a parallel event processing system using a flow of multiple gojq programs. Ex: I compile prog1.jq, execute prog1.jq in paralelel, both executions return a struct in the same memory position, which are then each used as variables in the next jq program of the flow in different go routines. That is how I found this situation, but I can see other scenarios where this can also be an issue. |
@afonsosribeiro same issue as in #212 ? which is as i understand it that |
@wader I discovered because of it, but they are not the same issue. |
Ok but doesn't it end being the same issue with sharing input? or you mean gojq should guarantee to never return a "shared" variable even if it is a constant literal in your jq program etc? |
@wader No it is not the same issue |
If the jq code contains a constant map (ex {"key":1}).
It will be compiled once and reused, but has it is a mutable struct it can be changd inside the Run, or returned as output and changed by the user.
Solution all mutable structs need to be instantiated at Runtime, never at compile time.
The text was updated successfully, but these errors were encountered: