Skip to content
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

Resizing the terminal kills bazel run tests #17215

Closed
the-mikedavis opened this issue Jan 13, 2023 · 3 comments
Closed

Resizing the terminal kills bazel run tests #17215

the-mikedavis opened this issue Jan 13, 2023 · 3 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) team-CLI Console UI type: bug

Comments

@the-mikedavis
Copy link

the-mikedavis commented Jan 13, 2023

Description of the bug:

Resizing the terminal while running bazel run TARGET when TARGET is a test rule makes the bazel process exit with code 156. This doesn't occur when TARGET is an executable but non-test rule.

I can reproduce this on Linux and macOS with Kitty, Alacritty and WezTerm terminal emulators with terms xterm-kitty and xterm-256color. Whether $PAGER is set or not doesn't seem to make a difference.

recording.mp4

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

I put together a MWE here: https://gist.github.com/the-mikedavis/6b34a7f445a30fb34331d1fa19b89201

Most minimally, a directory with an empty WORKSPACE file, a BUILD file with contents like so:

load("//:defs.bzl", "build")
build(name = "hello")

and defs.bzl:

def _impl(ctx):
    output = ctx.actions.declare_file(ctx.label.name)
    script = """echo "..."
    sleep 60
    echo "Hi!"
    """
    ctx.actions.write(
        output = output,
        content = script,
    )
    return [DefaultInfo(executable = output)]

build = rule(
    implementation = _impl,
    test = True,
)

Altogether the directory should look like so:

$ tree .
.
├── BUILD
├── defs.bzl
└── WORKSPACE

3 files

Run bazel run //:hello in this directory. Once you see the "...", resize the terminal. For resizing done through a window manager, you need to resize the terminal twice: the first resize doesn't kill bazel. The bazel process should exit with code 156.

Which operating system are you running Bazel on?

Linux, macOS

What is the output of bazel info release?

release 6.0.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

@sgowroji sgowroji added team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website untriaged type: bug labels Jan 16, 2023
@meteorcloudy meteorcloudy added team-CLI Console UI and removed team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website labels Jan 17, 2023
@larsrc-google larsrc-google added P2 We'll consider working on this in future. (Assignee optional) and removed untriaged labels Jan 24, 2023
@meisterT
Copy link
Member

meisterT added a commit to meisterT/bazel that referenced this issue Jan 24, 2023
Previously, after two window resize events we would stop waiting for the
child process - this makes sense for other signals but not for SIGWINCH.

Fixes bazelbuild#17215
@github-actions
Copy link

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 30 days. It will be closed in the next 7 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler".

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label Feb 24, 2023
@brentleyjones
Copy link
Contributor

Not stale.

@sgowroji sgowroji removed the stale Issues or PRs that are stale (no activity for 30 days) label Feb 24, 2023
ShreeM01 pushed a commit to ShreeM01/bazel that referenced this issue Mar 13, 2023
…rectly.

Previously, after two window resize events we would stop waiting for the child process.

`wait` is interrupted by any trapped signal (and we trap all signals), so we need to call it in a loop until the child really exited.

Fixes bazelbuild#17215

Closes bazelbuild#17301.

PiperOrigin-RevId: 514395755
Change-Id: Ifb763a55d53f230cde8b1ca77761d94ea6e43e1f
ShreeM01 added a commit that referenced this issue Mar 15, 2023
…rectly. (#17760)

Previously, after two window resize events we would stop waiting for the child process.

`wait` is interrupted by any trapped signal (and we trap all signals), so we need to call it in a loop until the child really exited.

Fixes #17215

Closes #17301.

PiperOrigin-RevId: 514395755
Change-Id: Ifb763a55d53f230cde8b1ca77761d94ea6e43e1f

Co-authored-by: Tobias Werth <twerth@google.com>
fweikert pushed a commit to fweikert/bazel that referenced this issue May 25, 2023
…rectly.

Previously, after two window resize events we would stop waiting for the child process.

`wait` is interrupted by any trapped signal (and we trap all signals), so we need to call it in a loop until the child really exited.

Fixes bazelbuild#17215

Closes bazelbuild#17301.

PiperOrigin-RevId: 514395755
Change-Id: Ifb763a55d53f230cde8b1ca77761d94ea6e43e1f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-CLI Console UI type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants