please icon indicating copy to clipboard operation
please copied to clipboard

packer receives SIGTTOU in plz 13.5.3 or later

Open thisguycodes opened this issue 7 years ago • 6 comments

As of please version 13.5.3, packer (version 1.4.1) gets a SIGTTOU when run inside plz. This behavior is not experienced when running manually inside a plz build --shell.

I have not done a search for the offending commit, but I imagine it's related to:

Process termination is more robust for test timeouts etc.

Packer versions prior to 1.4.0 (1.3.5 and earlier) do not have this problem.

Honestly I haven't quite figured out whether please or packer is "at fault". If I were to guess: packer started doing TTY setting changes in 1.4 (but its TTY detection is faulty), and please changed something about how it runs child processes that causes a false positive with packers TTY detection.

thisguycodes avatar May 22 '19 14:05 thisguycodes

The packer flag -machine-readable also fixes this issue. As well packer freezes in the same way if run as a background bash job, so I suspect this is meaningfully in packer's court, related to the:

Packer now uses a tty to receive user inputs.

Mentioned in the 1.4.0 release blog post.

thisguycodes avatar May 22 '19 14:05 thisguycodes

I've narrowed it down to "any time packer is used with job control". (issue on packer: https://github.com/hashicorp/packer/issues/7677)

Still curious what please is doing here, where it runs the job in a tty but doesn't allow mode changes? (that's somewhat a guess)

thisguycodes avatar May 22 '19 21:05 thisguycodes

That's odd. The commit in question is 691b3d661d06434b1e63479ea17fa4239e8621e9 which basically sets the process group and terminates that rather than just the process itself. Surprised that would change anything about TTYs, but maybe I am missing something. Have to admit I'm not very familiar at all with SIGTTOU...

Having said that, we don't run it with a TTY; it is a limited environment which occasionally some tools grump about (e.g. we don't set TERM).

peterebden avatar May 23 '19 11:05 peterebden

Would you happen to have a test case that you could share, by any chance?

peterebden avatar May 23 '19 11:05 peterebden

sets the process group <- that'll do it. Putting a child process into a new group means it's no longer "in the foreground process group", and attempts to modify / write to the tty get a SIGTTOU.

I do not, (if I manage to find time I will) but if you run packer 1.4.0 at all via please (don't even need arguments) will cause it to get SIGTTOU and freeze.

thisguycodes avatar May 29 '19 20:05 thisguycodes

This doesn't look like a plz specific issue - I feel Packer should be behaving better in this case.

macripps avatar Aug 28 '19 10:08 macripps