-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
--toolchain_resolution_debug output not ordered #12110
Comments
This makes sense, but I'm not sure if I'll have time to tackle it. The relevant code is in The one trick is that we'd want to only sort when outputting debug information, because otherwise we're slowing down all toolchain resolution. If you want to take a crack at it, I'd be happy to review a PR, otherwise it'd be nice to do but isn't a priority. |
Just ran into this. It makes this flag useless, as far as I can tell. |
…es to debug Work towards bazelbuild#12110. Fixes bazelbuild#7713.
…es to debug Work towards #12110. Fixes #7713. RELNOTES: The flag `--toolchain_resolution_debug` now takes a regex argument, which is used to check which toolchain types should have debug info printed. You may use `.*` as an argument to keep the current behavior of debugging every toolchain type. Closes #13207. PiperOrigin-RevId: 362413466
I would like to +1 that with the current output this flag honestly provides net negative value in debugging because the output is so confusing. Here's a completely bare-bones example of the output I get on my gLinux workstation with Bazel 3.7.0 (which I realize is not latest, but it doesn't seem like much has changed other than converting the flag to take a regex filter). Command: cd $(mktemp -d) && touch WORKSPACE && printf 'genrule(name = "gen_foo", outs = ["foo.py"], cmd = "touch $@")\npy_binary(name = "foo", srcs = ["foo.py"])\n' > BUILD && bazel build --toolchain_resolution_debug=true :foo Output:
Frankly, this only further confuses me. I have no idea what's actually happening in what order; python resolution steps are interspersed with C++ ones and any hierarchical relationship is lost. Some of the lines end in commas, but they don't seem related to the subsequent lines - I can't tell if this was a multi-line statement that was broken up by ordering or if the comma is just spurious. The indentation also doesn't make any sense (hopefully as a result of the lack of ordering, rather than a separate issue?). I see that #8502 raised this, but it was deduped to #7713 even though that doesn't really capture that aspect, and that issue was closed by #13207 which addresses only the "minimize output" aspect but IMO doesn't address any of the other various concerns about actually interpreting the output that is given. |
Thanks for the response. I haven't tried Bazel with the new flag (since it's not in 4.0.0 and I'm not aware of a particularly straightforward way to get a nightly build). But is it functionally any different from just grepping the output? For my actual problem, even grepping the toolchain resolution output for lines containing
As mentioned above, the indentation in particular really throws me off. My best guess after having spent quite a bit of time attempting to understand what this means is that it's sort in reverse order and that the greater indented lines are logically "children" of lines that come somewhere later in the output, but this is pretty counterintuitive IMO. If that's the case it would really help to have an opening line as well as a closing line to make it obvious that we're entering and exiting some new "scope" of resolution. Also, I don't know what to make of the one And then there's the things I mentioned that don't show up in the filtered output but are still confusing, like the trailing commas. For cases like this where the full output is only ~10 lines, it's not necessarily going to occur to a user that they need to filter it to see a consistent sub-sequence (if it even is consistent) and it's easy to get confused by red herrings. Overall, I imagine that this debug output might be useful to someone who's a Bazel toolchain and configuration expert. But to someone who's not, it's just cryptic. Maybe this flag is only meant for expert users but then it would be nice if it indicated in the help that this is the case. |
That makes sense, I'll update the flag's documentation. |
Feedback in #12110 is that the output of the flag is only useful to experts, so let's make that explicit. PiperOrigin-RevId: 369207954
Feedback in bazelbuild/bazel#12110 is that the output of the flag is only useful to experts, so let's make that explicit. PiperOrigin-RevId: 369207954
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team ( |
I am keeping #17814 as the canonical issue for "improve toolchain resolution debugging", so closing this but will keep the suggestions in mind. |
Description of the problem / feature request:
When running a build with
--toolchain_resolution_debug
, the output lines seem to come in random order, each time different, making it really hard to debug the underlying issue.Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
The text was updated successfully, but these errors were encountered: