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
notparallel
variable is broken
#1360
Comments
In GitLab by [Gitlab user @willsalmon] on Jul 10, 2020, 10:39 changed the description |
In GitLab by [Gitlab user @willsalmon] on Jul 10, 2020, 10:40 mentioned in merge request celduin/bsps/bst-boardsupport!17 |
In GitLab by [Gitlab user @cs-shadow] on Jul 17, 2020, 13:58 First, I am not able to reproduce this. In my experiments, BuildStream Core sets the
Also, I'm not sure if I follow this. You should be able to set |
In GitLab by [Gitlab user @tristanvb] on Nov 6, 2020, 09:24 Closing this with needinfo, please reopen if this is still an issue. |
I can reproduce this issue, can someone reopen this or should I file a new one? |
This feels unlikely, with which plugin are you able to reproduce? It is the plugin YAML which is responsible for setting Is Or, is it possible you are confusing the role of Or, is it possible that |
I'm still not sure exactly what happens as I'm yet to reproduce it locally but here is the element: https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/blob/abderrahim/bst2/elements/components/slang.bst And here is a failing build https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/jobs/1849722318/artifacts/file/cache/buildstream/logs/freedesktop-sdk/components-slang/9cfbabfb-build.169.log (notice MAKEFLAGS is set to -j8) |
It seems to be that |
What I have noticed is that if the element I'm passing on the command line has My current theory is that the variable in the plugin yaml are being expanded on the first use of the plugin (rather than making a copy and expanding the variables there). |
So the above theory is correct: expanding the variables in https://github.com/apache/buildstream/blob/master/src/buildstream/element.py#L2834 changes the value of the class variable The line responsible for this is diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index ee3b2fc75..b1c8d16a0 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -2947,7 +2947,7 @@ class Element(Plugin):
else:
environment = project.base_environment.clone()
- default_env._composite(environment)
+ default_env.clone()._composite(environment)
element_env._composite(environment)
environment._assert_fully_composited() |
Build in fdsdk using bst2 fail because of this atm: https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/jobs/1979958539 |
For now I'm adding this basic test which shows notparallel working properly: #1570 It would be good to expand on this to reproduce this quirky behavior we are seeing in fdsdk. |
Maybe the lines of code in master have shifted since this comment, my 2834 says: self.__environment = unexpanded_env.strip_node_info()
I'll try to summarize what should be happening here in
If your patch does indeed change something, then I think you've indeed found a bug in |
Yup, lines have shifted. The line in question is self.__variables.expand(unexpanded_env) So what happens is that Here is a minimal reproducer for the issue: from buildstream.node import Node
from buildstream._variables import Variables
default = Node.from_dict({'MAKEFLAGS': '-j%{max-jobs}'})
element = Node.from_dict({'name': 'my-element.bst'})
v = Variables(Node.from_dict({'max-jobs': '1'}))
print(default, element, sep='\n')
# [synthetic node]: {'MAKEFLAGS': '-j%{max-jobs}'}
# [synthetic node]: {'name': 'my-element.bst'}
default._composite(element)
print(default, element, sep='\n')
# [synthetic node]: {'MAKEFLAGS': '-j%{max-jobs}'}
# [synthetic node]: {'name': 'my-element.bst', 'MAKEFLAGS': '-j%{max-jobs}'}
v.expand(element)
print(default, element, sep='\n')
# [synthetic node]: {'MAKEFLAGS': '-j1'}
# [synthetic node]: {'name': 'my-element.bst', 'MAKEFLAGS': '-j1'} |
I just stumbled upon this old MR: https://gitlab.com/BuildStream/buildstream/-/merge_requests/1929 It seems to suggest we're indeed supposed to use |
I think that's indeed the right thing to do here as far as I can tell |
I think this is clearly wrong. Any code that I can think of which composites one mapping on top of another mapping, expects the source mapping to remain unmodified by the operation, only the target mapping should be affected by composition. What is likely happening here is that |
Are we still going to merge the bug fix? This is from freedesktop-sdk point of view beta blocker. |
I don’t want to merge the workaround for what I think is clear cut broken behavior of I’ve asked @BenjaminSchubert to come back and comment on this. |
[...]
So I'm trying to put together a minimal reproducer with a proper end-to-end test in I've got 2 manual elements where one depends on the other, and I'm unable to get one of them to pollute the other, by setting Setting either element to Were you able to reproduce this in a simplified end to end test ? |
Nope, my failed attempt is here: https://github.com/abderrahim/incorrect-max-jobs I'll try to find out what the problem is. |
Maybe composite itself could be unittested to get it to break? |
Here you go: https://github.com/abderrahim/incorrect-max-jobs
|
Possible but I'm really more interested in reproducing the issue with an end-to-end test, I'd rather keep internal unit testing down to a minimum if and when it is at all possible to reproduce a bug in action. |
…el issue This test recreates the scenario described in #1360 in an end-to-end test, by providing a custom plugin which makes use of %{max-jobs} substitution in the default environment variables provided in the plugin's default YAML.
I've provided an isolated test case for this in the https://github.com/apache/buildstream/tree/tristan/test-notparallel branch now (#1570). To observe the broken behavior, you can type |
As we've observed in #1360, it occurs that in composition, instead of overwriting the target nodes with copies of source values, we insert the mutable source values directly onto the target, this leaves the source nodes vulnerable to future mutations when the code goes on to mutate the resulting composited target. Fixes #1360.
…el issue This test recreates the scenario described in #1360 in an end-to-end test, by providing a custom plugin which makes use of %{max-jobs} substitution in the default environment variables provided in the plugin's default YAML.
Now #1570 has been updated to contain both:
|
…el issue This test recreates the scenario described in #1360 in an end-to-end test, by providing a custom plugin which makes use of %{max-jobs} substitution in the default environment variables provided in the plugin's default YAML.
…el issue This test recreates the scenario described in #1360 in an end-to-end test, by providing a custom plugin which makes use of %{max-jobs} substitution in the default environment variables provided in the plugin's default YAML.
See original issue on GitLab
In GitLab by [Gitlab user @willsalmon] on Jul 10, 2020, 10:39
Summary
The
notparallel
variable dose not seem to forceMAKEFLAGS: -j1
in the environmentThis means that projects that have bugs associated with
make -j2
can not be built, eg slang.Please see the failure: https://gitlab.com/celduin/bsps/bst-boardsupport/-/jobs/625698066
The variable being incorrectly set on line 21 in the log: https://gitlab.com/celduin/bsps/bst-boardsupport/-/jobs/625698066/artifacts/file/artifact/freedesktop-sdk/components-slang/1ad3d1df-build.3146.log
The element https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/blob/master/elements/components/slang.bst showing the:
The problem is further compounded by the fact that bst will not let you set
MAKEFLAGS
in the environment section as it isprotected
The text was updated successfully, but these errors were encountered: