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

Fix a race detected only if a test times out #3808

Merged
merged 2 commits into from
Jan 2, 2024

Conversation

patrickmscott
Copy link
Contributor

I believe this can happen because the goroutine is started before the command is started. Start the process first, then on success, start the signal handler. Add a test for regression.

I verified the test fails without my change to wrap.go and the race is from the signal handling goroutine.

What type of PR is this?

Bug fix

What does this PR do? Why is it needed?

It prevents a race detection when a test is timed out. We saw this a bunch and devs were really confused thinking there was a legit race detected.

Which issues(s) does this PR fix?

Fixes #

Other notes for review

I believe this can happen because the goroutine is started before the
command is started. Start the process first, then on success, start the
signal handler. Add a test for regression.

I verified the test fails without my change to wrap.go and the race is
from the signal handling goroutine.
@fmeum
Copy link
Collaborator

fmeum commented Jan 2, 2024

@patrickmscott Thanks for catching this. I'm still not sure I understand why there is a race in the first place. Could you post the race detector trace you see?

Nevermind, this makes sense, I missed that we are accessing Process on cmd.

go/tools/bzltestutil/wrap.go Outdated Show resolved Hide resolved
@fmeum fmeum enabled auto-merge (squash) January 2, 2024 16:04
@fmeum fmeum disabled auto-merge January 2, 2024 16:09
@fmeum fmeum enabled auto-merge (squash) January 2, 2024 16:11
@fmeum fmeum merged commit 5540b97 into bazelbuild:master Jan 2, 2024
1 of 2 checks passed
cgrindel-self-hosted-renovate bot added a commit to cgrindel/bazel-starlib that referenced this pull request Jan 3, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [io_bazel_rules_go](https://togithub.com/bazelbuild/rules_go) |
http_archive | patch | `v0.44.1` -> `v0.44.2` |

---

### Release Notes

<details>
<summary>bazelbuild/rules_go (io_bazel_rules_go)</summary>

###
[`v0.44.2`](https://togithub.com/bazelbuild/rules_go/releases/tag/v0.44.2)

[Compare
Source](https://togithub.com/bazelbuild/rules_go/compare/v0.44.1...v0.44.2)

#### `WORKSPACE` code

load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl",
"http_archive")

    http_archive(
        name = "io_bazel_rules_go",
sha256 =
"7c76d6236b28ff695aa28cf35f95de317a9472fd1fb14ac797c9bf684f09b37c",
        urls = [

"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.44.2/rules_go-v0.44.2.zip",

"https://github.com/bazelbuild/rules_go/releases/download/v0.44.2/rules_go-v0.44.2.zip",
        ],
    )

load("@&#8203;io_bazel_rules_go//go:deps.bzl", "go_register_toolchains",
"go_rules_dependencies")

    go_rules_dependencies()

    go_register_toolchains(version = "1.21.5")

#### What's Changed

- Make C++ toolchain optional by
[@&#8203;illicitonion](https://togithub.com/illicitonion) in
[bazelbuild/rules_go#3390
- Fix a race detected only if a test times out by
[@&#8203;patrickmscott](https://togithub.com/patrickmscott) in
[bazelbuild/rules_go#3808
- registering timeout handler synchronously by
[@&#8203;linzhp](https://togithub.com/linzhp) in
[bazelbuild/rules_go#3810
- patch release 0.44.2 by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/rules_go#3811

**Full Changelog**:
bazelbuild/rules_go@v0.44.1...v0.44.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDAuMCIsInVwZGF0ZWRJblZlciI6IjM2LjEwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: Self-hosted Renovate Bot <361546+cgrindel-self-hosted-renovate[bot]@users.noreply.github.enterprise.com>
renovate bot added a commit to kreempuff/rules_unreal_engine that referenced this pull request Jan 3, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [io_bazel_rules_go](https://togithub.com/bazelbuild/rules_go) |
http_archive | patch | `v0.44.1` -> `v0.44.2` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>bazelbuild/rules_go (io_bazel_rules_go)</summary>

###
[`v0.44.2`](https://togithub.com/bazelbuild/rules_go/releases/tag/v0.44.2)

[Compare
Source](https://togithub.com/bazelbuild/rules_go/compare/v0.44.1...v0.44.2)

#### `WORKSPACE` code

load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl",
"http_archive")

    http_archive(
        name = "io_bazel_rules_go",
sha256 =
"7c76d6236b28ff695aa28cf35f95de317a9472fd1fb14ac797c9bf684f09b37c",
        urls = [

"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.44.2/rules_go-v0.44.2.zip",

"https://github.com/bazelbuild/rules_go/releases/download/v0.44.2/rules_go-v0.44.2.zip",
        ],
    )

load("@&#8203;io_bazel_rules_go//go:deps.bzl", "go_register_toolchains",
"go_rules_dependencies")

    go_rules_dependencies()

    go_register_toolchains(version = "1.21.5")

#### What's Changed

- Make C++ toolchain optional by
[@&#8203;illicitonion](https://togithub.com/illicitonion) in
[bazelbuild/rules_go#3390
- Fix a race detected only if a test times out by
[@&#8203;patrickmscott](https://togithub.com/patrickmscott) in
[bazelbuild/rules_go#3808
- registering timeout handler synchronously by
[@&#8203;linzhp](https://togithub.com/linzhp) in
[bazelbuild/rules_go#3810
- patch release 0.44.2 by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/rules_go#3811

**Full Changelog**:
bazelbuild/rules_go@v0.44.1...v0.44.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/kreempuff/rules_unreal_engine).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMDMuMSIsInVwZGF0ZWRJblZlciI6IjM3LjEwMy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
cgrindel-self-hosted-renovate bot added a commit to cgrindel/rules_swift_package_manager that referenced this pull request Jan 7, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [io_bazel_rules_go](https://togithub.com/bazelbuild/rules_go) |
http_archive | patch | `v0.44.1` -> `v0.44.2` |

---

### Release Notes

<details>
<summary>bazelbuild/rules_go (io_bazel_rules_go)</summary>

###
[`v0.44.2`](https://togithub.com/bazelbuild/rules_go/releases/tag/v0.44.2)

[Compare
Source](https://togithub.com/bazelbuild/rules_go/compare/v0.44.1...v0.44.2)

#### `WORKSPACE` code

load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl",
"http_archive")

    http_archive(
        name = "io_bazel_rules_go",
sha256 =
"7c76d6236b28ff695aa28cf35f95de317a9472fd1fb14ac797c9bf684f09b37c",
        urls = [

"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.44.2/rules_go-v0.44.2.zip",

"https://github.com/bazelbuild/rules_go/releases/download/v0.44.2/rules_go-v0.44.2.zip",
        ],
    )

load("@&#8203;io_bazel_rules_go//go:deps.bzl", "go_register_toolchains",
"go_rules_dependencies")

    go_rules_dependencies()

    go_register_toolchains(version = "1.21.5")

#### What's Changed

- Make C++ toolchain optional by
[@&#8203;illicitonion](https://togithub.com/illicitonion) in
[bazelbuild/rules_go#3390
- Fix a race detected only if a test times out by
[@&#8203;patrickmscott](https://togithub.com/patrickmscott) in
[bazelbuild/rules_go#3808
- registering timeout handler synchronously by
[@&#8203;linzhp](https://togithub.com/linzhp) in
[bazelbuild/rules_go#3810
- patch release 0.44.2 by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/rules_go#3811

**Full Changelog**:
bazelbuild/rules_go@v0.44.1...v0.44.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDAuMCIsInVwZGF0ZWRJblZlciI6IjM2LjEwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: Self-hosted Renovate Bot <361546+cgrindel-self-hosted-renovate[bot]@users.noreply.github.enterprise.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants