You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having an issue with Terraform hanging on apply or plan. Setting TF_LOG=1 doesn't seem to reveal any useful information, and running strace isn't overly helpful as well.
I've tried this with GOMAXPROCS set to 16, and unset.
I've only recently fiddled with GOMAXPROCS (approximately the same time as this issue started) because I'm running a local Consul cluster for testing terraform -> Consul.
Running it under strace with just network tracing on shows Terraform trying to connect to a 169.254.169.254 address, I wonder if it has something to do an AWS provider?
Going back several versions in my commit log doesn't seem to help, even commits that I know were working a week ago, etc. Trying with 0.5.3 and 0.6.2 each time I go back a commit still gives me the hang.
UPDATE:
Actually, I've found I was just too impatient. The plan returned correct output after 20 minutes! So, still some sort of issue there. Terraform log here: http://pastebitch.com/MBfA
@typerlc weird! It's possible that could happen due to transient networking issues - is this something that happens every time for you? If so, can you open a fresh issue with the config that reproduces? Thanks!
@typerlc is it possible that you ran terraform plan without AWS credentials set, either in your config or in the environment?
The AWS provider has some special behavior to try to obtain instance role credentials as if it were running on an EC2 instance, which applies if it doesn't find any explicit credentials in the configuration. This involves reaching out to http://169.254.169.254/latest/meta-data/, which of course won't do the right thing if you're not actually running on an EC2 instance... it could do anything from time out trying to send packets into oblivion, to getting a "no route to host" error, to actually talking to a different machine in your local network that happens to have that IP address.
I've personally run into this a few times and it ends up looking a lot like a hang. I expect it could be addressed by setting a pretty aggressive timeout on that request, assuming that the metadata endpoint on EC2 should respond reasonably quickly if you're actually on an EC2 instance.
@phinze I doubt its a networking issue. Happens from my office network, mobile phone network and home network. While doing this, I have also browsed the internet, accessed the AWS console, etc.
As requested, I've opened a new issue #3118 to track.
@apparentlymart My .tf file had my AWS credentials. I've included my config file in the new issue #3118.
For anyone hitting this issue against AWS, be sure to check the AWS Service Health Dashboard. For instance, currently IAM N. Virginia is reporting We are continuing to investigate increased error rates and latencies on IAM administrative APIs and Console. This can cause aws.iam.GetUser to take several minutes to complete (possibly retrying multiple times after getting a 503 response), making Terraform appear to hang at startup.
Activity
LeftyBC commentedon Jul 29, 2015
Debug log at: http://pastebitch.com/TOMO
LeftyBC commentedon Jul 29, 2015
I've tried this with GOMAXPROCS set to 16, and unset.
I've only recently fiddled with GOMAXPROCS (approximately the same time as this issue started) because I'm running a local Consul cluster for testing terraform -> Consul.
ryanking commentedon Jul 29, 2015
I'm having the same problem since yesterday:
https://gist.github.com/ryanking/94986ce2450984d77358
When it stalls there are typically a number of processes running:
Running dtruss on them reveals a lot of select looping:
I first had the problem on 0.6.0 yesterday. Upgrading to 0.6.1 didn't help. I tried older versions of my terraform configs and those also hung.
A colleague did a run on 0.5.3 and saw the same problem.
I've tried setting GOMAXPROCS to a ridiculously high number and that didn't help.
phinze commentedon Jul 29, 2015
This is definitely odd. I'm suspicious of the "close" nodes I'm seeing towards the bottom of both of your debug logs...
From the 0.6.0 changelog:
I know one of you had a coworker try v0.5.3... can you both double check with v0.5.3?
ryanking commentedon Jul 29, 2015
Here is my coworker running the same configs with 0.5.3:
https://gist.github.com/anonymous/e27884ec1d834ae16b33
it stalls too
LeftyBC commentedon Jul 29, 2015
Debug log for 0.5.3: http://pastebitch.com/CATC
I did have to change the catalog a bit to get around some 0.5.x bugs with providers, so it's not identical, but it still stalls.
LeftyBC commentedon Jul 29, 2015
Running it under strace with just network tracing on shows Terraform trying to connect to a 169.254.169.254 address, I wonder if it has something to do an AWS provider?
http://pastebitch.com/eZAJ
ryanking commentedon Jul 29, 2015
@LeftyBC Interesting that you have several processes trying to connect there.
ryanking commentedon Jul 29, 2015
Perhaps this timeout is not working:
terraform/builtin/providers/aws/provider.go
Line 39 in c721738
phinze commentedon Jul 29, 2015
These are good theories. Trying to do a bit of differential diagnosis here.
The metadata service
169.254.169.254authentication mechanism was added between v0.6.0 and v0.6.1 da1cac6The close provider feature was added between v0.5.3 and v0.6.0.
So the fact that it stalls for both of you on 0.5.3 as well seems to discredit those theories.
Does any binary searching through your configs by commenting out portions seem to affect the reproduction of the hanging?
phinze commentedon Jul 29, 2015
Similarly, do any runs from your commit history avoid the hang? Hopefully with more data like this we can narrow down the issue.
LeftyBC commentedon Jul 29, 2015
I'll go back through the commit log and see if I can get it to not hang, stand by.
LeftyBC commentedon Jul 29, 2015
Going back several versions in my commit log doesn't seem to help, even commits that I know were working a week ago, etc. Trying with 0.5.3 and 0.6.2 each time I go back a commit still gives me the hang.
Debug log for 0.6.1 with GOMAXPROCS=254 on a commit that I know should work: http://pastebitch.com/DAfA
Here's the strace output for the run that generated the above debug log - I killed it just after the normal hang: http://pastebitch.com/eFbg
9 remaining items
LeftyBC commentedon Jul 29, 2015
I think so. I also changed the name of the resource that was referring to the module after I moved it to the environment submodule.
In the root, it was
It was then moved to the environment submodule in
modules/environments/opsdev:I then changed it to:
I believe this is what left a bunch of "empty" modules in the state, as @ryanking saw.
core: fix deadlock when dependable node replaced with non-dependable one
core: fix deadlock when dependable node replaced with non-dependable one
core: fix deadlock when dependable node replaced with non-dependable one
core: fix deadlock when dependable node replaced with non-dependable one
phinze commentedon Aug 13, 2015
Hey folks - this should be fixed in Terraform 0.6.3. Let me know if you still have any troubles on that version!
typerlc commentedon Aug 28, 2015
I have this issue with 0.6.3 on Mac OSX Yosemite. In case it matters, it was installed via brew.
Running terraform plan on the first getting start guide example.tf causes a hang, with the following repeatedly output when TF_LOG=1
$ TF_LOG=1 terraform plan
...
2015/08/28 12:34:45 [DEBUG] vertex provider.aws (close), waiting for: aws_instance.example
2015/08/28 12:34:45 [DEBUG] vertex aws_instance.example, waiting for: provider.aws
2015/08/28 12:34:45 [DEBUG] vertex root, waiting for: provider.aws (close)
$ terraform show
No state.
UPDATE:
Actually, I've found I was just too impatient. The plan returned correct output after 20 minutes! So, still some sort of issue there. Terraform log here: http://pastebitch.com/MBfA
phinze commentedon Aug 28, 2015
@typerlc weird! It's possible that could happen due to transient networking issues - is this something that happens every time for you? If so, can you open a fresh issue with the config that reproduces? Thanks!
apparentlymart commentedon Aug 28, 2015
@typerlc is it possible that you ran
terraform planwithout AWS credentials set, either in your config or in the environment?The AWS provider has some special behavior to try to obtain instance role credentials as if it were running on an EC2 instance, which applies if it doesn't find any explicit credentials in the configuration. This involves reaching out to
http://169.254.169.254/latest/meta-data/, which of course won't do the right thing if you're not actually running on an EC2 instance... it could do anything from time out trying to send packets into oblivion, to getting a "no route to host" error, to actually talking to a different machine in your local network that happens to have that IP address.I've personally run into this a few times and it ends up looking a lot like a hang. I expect it could be addressed by setting a pretty aggressive timeout on that request, assuming that the metadata endpoint on EC2 should respond reasonably quickly if you're actually on an EC2 instance.
typerlc commentedon Aug 29, 2015
@phinze I doubt its a networking issue. Happens from my office network, mobile phone network and home network. While doing this, I have also browsed the internet, accessed the AWS console, etc.
As requested, I've opened a new issue #3118 to track.
@apparentlymart My .tf file had my AWS credentials. I've included my config file in the new issue #3118.
trevorr commentedon Aug 22, 2016
For anyone hitting this issue against AWS, be sure to check the AWS Service Health Dashboard. For instance, currently IAM N. Virginia is reporting
We are continuing to investigate increased error rates and latencies on IAM administrative APIs and Console.This can causeaws.iam.GetUserto take several minutes to complete (possibly retrying multiple times after getting a 503 response), making Terraform appear to hang at startup.iahmad-khan commentedon Oct 31, 2019
Same issue on latest version.