WSL: terraform epoll_wait high cpu utilization

This bug-tracker is monitored by developers and other technical types. We like detail! So please use this form and tell us, concisely but precisely, what’s up. Please fill out ALL THE FIELDS!

If you have a feature request, please post to the UserVoice.

If this is a console issue (a problem with layout, rendering, colors, etc.), please post to the console issue tracker.

Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues. Instead, send dumps/traces to secure@microsoft.com, referencing the GitHub bug number. Ideally, please configure your machine to capture minidumps, repro the issue, and send the minidump from "C:\Windows\minidump".

  • Your Windows build number: (Type ver at a Windows Command Prompt)

Microsoft Windows [Version 10.0.16299.431]

  • What you’re doing and what’s happening: (Copy&paste specific commands and their output, or include screen shots) I am using terraform to start virtual infrastructure in aws. while terraform is waiting for input, it experiences very high cpu utilization. this appears to be related to epoll_wait. the WSL version of terraform experiences this high cpu, where as the windows version does not.

I am quite aware that the developers are not necessarily familiar with terraform, but this issue no longer appears to be a terraform but instead an issue with how WSL handles the epoll_wait calls.

terraform apply

screen shots WSL version show very high cpu while waiting for use input terraform-high-cpu-2 windows version of terraform showing non high cpu terraform-windows

terraform -v

Terraform v0.11.3
+ provider.aws v1.21.0

WSL / ubuntu for windows (on windows 10 build 1709)

Distributor ID: Ubuntu
Description:    Ubuntu 16.04.3 LTS
Release:        16.04
Codename:       xenial

terraform mainfest

# ca04test01
resource "aws_instance" "ca04test01" {
	key_name = "${var.keypair}"	
	ami = "${var.ami_xenial}"
	instance_type = "${var.server_type["ca04test01"]}"
	subnet_id = "${var.subnet_production["ent_app_preprod"]}"
	private_ip = "${var.server_ip["ca04test01"]}"
	# vpc_security_group_ids has to be a list, so enclose in [] to make it a 1 item list
	vpc_security_group_ids = ["${var.sg_production["ent_app_preprod"]}"]
	
	lifecycle {
		ignore_changes = ["tags"]
	}
	count = "1"
	user_data = "#cloud-config\nhostname: ca04test01.agilitypr.internal\nfqdn: ca04test01.agilitypr.internal"

	tags {
		type = "test"
		role = "test"
		Name = "ca04test01"
	}
	
	provisioner "remote-exec" {
		inline = [
			"printf '\n${var.server_ip["ca04test01"]} ca04test01.agilitypr.internal' | sudo tee -a /etc/hosts",
			"sleep 1" # trick to get terraform to finish above command before closing ssh conn
			# command || true # force command to exit and allow terraform to continue
		]
		connection {
			type = "ssh"
			user = "ubuntu"
		}
	}
}
  • What’s wrong / what should be happening instead:

While waiting for user input the application should not be using very high cpu

  • Strace of the failing command, if applicable: (If some_command is failing, then run strace -o some_command.strace -f some_command some_args, and link the contents of some_command.strace in a gist here)

straces gist: https://gist.github.com/jgrammen-agilitypr/47bf7baa6d81b1bbccd6e9189c047aff

See our contributing instructions for assistance.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 23 (1 by maintainers)

Most upvoted comments

Testing on build 17728 ( somehow it skipped 17723 ) confirms that the issue with high load is fixed.

17728-no-high-cpu

Fixed in build 17723

This is an issue with pipes and the EPOLLET epoll event flag, where the EPOLLET part is not being respected so the epoll_wait always returns immediately.

the issue is not fixed in 17134.

17134-high-cpu

my next step will be to test insiders / latest preview build

@therealkenc - indeed, that is quite an oversight on my part; likely unrelated issues.

It was almost duped right out of the gate. The ambiguity was caused by this (from #3191):

Tested and succeeded in 17134 and 17661.

The OP here is 16299.

testing on insider preview 17682 same problem, issue not resolved

17682-high-cpu