Skip to content

Conversation

steweg
Copy link
Contributor

@steweg steweg commented Oct 4, 2025

This patch fixes the segfault, which is happening when RPC output data, which uses NP-container with when condition are being validated.

@steweg
Copy link
Contributor Author

steweg commented Oct 4, 2025

I have to say that I am not 100% sure if my "fix" is correct.

The root cause is that when validation of RPC output is being performed, it add implicit nodes for some reason (don't know why), which can have when condition set. That automatically adds the node into nodes_when for evaluation of when later on. But subsequently further validation steps adds the node again into nodes_when. Then later during evaluation of unresolved nodes_when, the code evaluate first one as false and remove the node for good. And during second evaluation hits segfault conditions.

There can be multiple ways how to fix it, but from my perspective I don't understand why the ly_set_add has ability to behave like list and is actually used like that in case of nodes_when. Maybe it was done due to performance optimizations or something like that, but apparently has side effects. So solution is to either change usage of nodes_when back to set behavior or adjust the logic which validates RPC output somehow so that it will not add nodes twice into nodes_when

I will leave it up to you to judge

@steweg steweg force-pushed the bugfix/rpc_output_container_when branch 2 times, most recently from 7e1de17 to 98cabd1 Compare October 5, 2025 00:02
This patch fixes the segfault, which is happening when RPC output data,
which uses NP-container with when condition are being validated.
@steweg steweg force-pushed the bugfix/rpc_output_container_when branch from 98cabd1 to 8d00d9d Compare October 5, 2025 00:08
michalvasko added a commit that referenced this pull request Oct 6, 2025
@michalvasko michalvasko merged commit 8d00d9d into CESNET:devel Oct 6, 2025
11 checks passed
@michalvasko
Copy link
Member

Thanks for the test but the proper fix was a bit different and the optimization of using the set as a list could remain.

@steweg steweg deleted the bugfix/rpc_output_container_when branch October 6, 2025 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants