-
-
Notifications
You must be signed in to change notification settings - Fork 967
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
run-all show -json
mangles output for very large plans
#3427
Comments
Hi, Can you share an example code/repo where this issue happens? |
i was able to reproduce the error in your test project with a slight change: cp -a app app2
cp -a app app3
terragrunt run-all plan -out planfile
terragrunt run-all show -json planfile >out.json looking at out.json, you will get a bunch of garbled json starting from line 2 |
Hi @hojerst, I repeated this
and what I see in Could you show me what exactly is wrong here? |
unfortunately i don't see how you created this colored output, so i'm not sure which of the 3 planfiles it actually is. in my setup the first plan-json (first line) is completely fine. The second and 3rd plan are cut off however. I can reproduce this by # print only second line of stdout
terragrunt run-all show -json planfile | sed -n 2p this will look something like this:
note: its not an issue of the processor/sed - i just used sed here for sake of simplicity. i get weird errors piping the output to I noticed now, that this actually seems to be a race condition of a kind: Sometime there are actually 3 valid json documents (one per line) created, especially when piping in a file instead of a program. however repeating the steps some times, it actually cuts off the documents again. Could it be some kind of "buffer is full and data is dropped, if the buffer isn't flushed fast enough" issue? |
Try with
|
hm my version is 3 weeks old (0.67.3) and doesn't have this flag yet. i'm currently using nixpkgs for my toolchain and the latest version right now is 0.67.3... i'll try with the latest binary from here... |
note: terragrunt version v0.67.14 on M1 Max MacBook Pro i just ran the snippet multiple times, piping directly to jq, so i don't have to scroll and look for a broken json manually. the problem still persists with randomly broken json documents: this is the output of two consecutive runs - the first printing the first json document fine, then failing on the second. the next call failed even on the first document / plan json output [... snip - everything fine ...]
]
}
],
"timestamp": "2024-09-24T20:22:17Z",
"errored": false
}
jq: parse error: Invalid literal at line 2, column 32785
❯ ~/.local/bin/terragrunt run-all show --terragrunt-log-disable -json planfile | jq
jq: parse error: Invalid literal at line 1, column 98321 |
I figured out why this happens. When we run |
While we are working on a fix, you can use the |
Describe the bug
When running
terragrunt run-all show -json
for very large plans, the output is mangled and no longer a valid json document. i assume its an issue with a line buffer, as the json fromterraform show -json
is all printed to a single line. using the normal, colored output the json document is cut after 65536 characters and when using--terragrunt-forward-tf-stdout
the output seems to be cut at the beginning.Steps To Reproduce
terraform show -json planfile
terragrunt run-all show -json
for the folder containing the planExpected behavior
the json output should be complete without any content cut
Nice to haves
Versions
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: