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

build: update patch with bug fix to runtime grunning #118907

Merged
merged 1 commit into from
Feb 22, 2024

Conversation

aadityasondhi
Copy link
Collaborator

In our previous version of this patch, we missed two entry points and one exit point into the grunning state of a Goroutine. This led to grunning.Time() being non-monotonic.

This new patch adds those missing integration points.

Fixes #95529.

Release note: None

@aadityasondhi aadityasondhi requested review from sumeerbhola and a team February 7, 2024 19:02
@aadityasondhi aadityasondhi requested a review from a team as a code owner February 7, 2024 19:02
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@rickystewart rickystewart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stamp

@rickystewart
Copy link
Collaborator

Started TeamCity build

@aadityasondhi aadityasondhi force-pushed the 20240205.grunning-patch branch from d4d52ad to 84925d0 Compare February 7, 2024 20:12
@aadityasondhi
Copy link
Collaborator Author

Previous patch was corrupted because I tried to minimize the lines changed. This one applies well but changes a lot more lines. Am I doing it correctly @rickystewart?

Steps I followed:

  1. I checkout out the go1.21.3 branch.
  2. Applied the old patches
  3. Made my changes
  4. Copied the output of git diff into the patch file

@aadityasondhi aadityasondhi force-pushed the 20240205.grunning-patch branch from 84925d0 to 221e0e4 Compare February 7, 2024 20:23
@rickystewart
Copy link
Collaborator

Can you put the diff for src/context/context.go back on the bottom of the file? I know it's not in alphabetical order, but that's how it was for whatever reason. It'll be easier to see what you actually changed if the filenames are in the same order.

Copy link
Collaborator

@sumeerbhola sumeerbhola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: regarding the actual code changes modulo the need for code comments.

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @aadityasondhi)


build/teamcity/internal/release/build-and-publish-patched-go/diff.patch line 113 at r3 (raw file):

--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -1004,6 +1004,9 @@ func casfrom_Gscanstatus(gp *g, oldval, newval uint32) {

We have two comments in the existing patch:

// We're transitioning into the running state, record the timestamp for  
// subsequent use.
// We're transitioning out of running, record how long we were in the  
// state.

can you add the relevant comment to these new changes too.

@aadityasondhi aadityasondhi force-pushed the 20240205.grunning-patch branch from 221e0e4 to 4cf5e85 Compare February 7, 2024 20:48
_32bit uintptr // size on 32bit platforms
_64bit uintptr // size on 64bit platforms
}{
- {runtime.G{}, 252, 408}, // g, but exported for testing
+ {runtime.G{}, 260, 416}, // g, but exported for testing
{runtime.Sudog{}, 56, 88}, // sudog, but exported for testing
}
diff -ru a/src/context/context.go b/src/context/context.go

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blank line here seems wrong

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear: if the diff apply works, don't worry about removing the blank line. Just a thought I had as I was reviewing.

@rickystewart
Copy link
Collaborator

Trying another build, we'll see if this works.

@rickystewart rickystewart force-pushed the 20240205.grunning-patch branch from 4cf5e85 to b523584 Compare February 8, 2024 19:55
@rickystewart
Copy link
Collaborator

Looks like it worked. I updated the PR and then we'll see if CI is happy.

@aadityasondhi aadityasondhi force-pushed the 20240205.grunning-patch branch 3 times, most recently from 3960a3e to 11fbe3d Compare February 20, 2024 19:17
@aadityasondhi
Copy link
Collaborator Author

Had to rebase on top of the changes made in #118605.

@rickystewart let me know if this is good to merge

Copy link
Collaborator Author

@aadityasondhi aadityasondhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @rickystewart and @sumeerbhola)


build/teamcity/internal/release/build-and-publish-patched-go/diff.patch line 113 at r3 (raw file):

Previously, sumeerbhola wrote…

We have two comments in the existing patch:

// We're transitioning into the running state, record the timestamp for  
// subsequent use.
// We're transitioning out of running, record how long we were in the  
// state.

can you add the relevant comment to these new changes too.

Done.

Copy link
Collaborator Author

@aadityasondhi aadityasondhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @rickystewart and @sumeerbhola)


build/teamcity/internal/release/build-and-publish-patched-go/diff.patch line 187 at r4 (raw file):

Previously, rickystewart (Ricky Stewart) wrote…

To be clear: if the diff apply works, don't worry about removing the blank line. Just a thought I had as I was reviewing.

Done.

@rickystewart
Copy link
Collaborator

@rickystewart let me know if this is good to merge

No. We need to build the SDK and incorporate it into your PR. I can get this process started for you.

@aadityasondhi
Copy link
Collaborator Author

@rickystewart let me know if this is good to merge

No. We need to build the SDK and incorporate it into your PR. I can get this process started for you.

Thanks! let me know if I need to do anything to move this forward.

@rickystewart
Copy link
Collaborator

@aadityasondhi Go ahead and apply this diff and we'll see if CI is okay with this.

diff --git a/WORKSPACE b/WORKSPACE
index dd157813027..31fddffb5b1 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -165,13 +165,13 @@ load(
 go_download_sdk(
     name = "go_sdk",
     sdks = {
-        "darwin_amd64": ("go1.21.5.darwin-amd64.tar.gz", "9a9af12fddf7315db68ceeb2980d9cecbf058d50356787bc1680417d9c5892eb"),
-        "darwin_arm64": ("go1.21.5.darwin-arm64.tar.gz", "7a5c1f1ca0831980ea06e7383a7e56af7665f8863bc923e19fd050c9fd4866a9"),
-        "linux_amd64": ("go1.21.5.linux-amd64.tar.gz", "7656c08487ea9d8817047be5698bf96a787c195e237d62c2d605ad754c55022d"),
-        "linux_arm64": ("go1.21.5.linux-arm64.tar.gz", "5ca30901c990538e21a8adf4a0945b013ecae34cfbfc3fbac893ac24c2c33c0c"),
-        "windows_amd64": ("go1.21.5.windows-amd64.tar.gz", "f32ad2e23031dc7e43db29dce7bf0cb1bba095760f96972ace094159f6bd2986"),
+        "darwin_amd64": ("go1.21.5.darwin-amd64.tar.gz", "182c3e597111d474b29d72fbfee1ddb2915acd39b7c3e534a78eaddfa767089d"),
+        "darwin_arm64": ("go1.21.5.darwin-arm64.tar.gz", "1894e6f86814cd882c51bb5a73cf1312551c734bd4ac9fb33866df2a50e1d1a0"),
+        "linux_amd64": ("go1.21.5.linux-amd64.tar.gz", "ff04d463bf9da03cfe6aefeff6039312c701f74ab291162b937b31026f262228"),
+        "linux_arm64": ("go1.21.5.linux-arm64.tar.gz", "9a09561064580e837af46bc314536b450bd2546985955ddf1e70699a4abe2fb6"),
+        "windows_amd64": ("go1.21.5.windows-amd64.tar.gz", "93375cd3e51b811297a52a0e7a9d98b126da3ae02daaabb5d423e1c496275f06"),
     },
-    urls = ["https://storage.googleapis.com/public-bazel-artifacts/go/20240201-224012/{}"],
+    urls = ["https://storage.googleapis.com/public-bazel-artifacts/go/20240220-195058/{}"],
     version = "1.21.5",
 )
 
@@ -659,8 +659,8 @@ go_download_sdk(
     # able to provide additional diagnostic information such as the expected version of OpenSSL.
     experiments = ["boringcrypto"],
     sdks = {
-        "linux_amd64": ("go1.21.5fips.linux-amd64.tar.gz", "33bc9129c5a9ebc3a5f6deb3e651f05216a035479404c849d443d0930aec2b6a"),
+        "linux_amd64": ("go1.21.5fips.linux-amd64.tar.gz", "68fefc15b4328244fe78f1269e8856a2a2cd52f1fb9f451bb8bc0c23d590fe14"),
     },
-    urls = ["https://storage.googleapis.com/public-bazel-artifacts/go/20240201-224012/{}"],
+    urls = ["https://storage.googleapis.com/public-bazel-artifacts/go/20240220-195058/{}"],
     version = "1.21.5fips",
 )
diff --git a/build/bazelutil/distdir_files.bzl b/build/bazelutil/distdir_files.bzl
index f7dbe5ad2bb..c2930425459 100644
--- a/build/bazelutil/distdir_files.bzl
+++ b/build/bazelutil/distdir_files.bzl
@@ -1202,12 +1202,12 @@ DISTDIR_FILES = {
     "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20230718-202534/libproj_foreign.macos.20230718-202534.tar.gz": "96771a33542beb72067afcafaeb790134014e56798fa4cbe291894c4ebf8b68d",
     "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20230718-202534/libproj_foreign.macosarm.20230718-202534.tar.gz": "b2c60ffe1f50c6e81ba906f773b95d3a6699538d57e71749579552f4211a1e3e",
     "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20230718-202534/libproj_foreign.windows.20230718-202534.tar.gz": "16de1e76ee8de4bd144dc57bfde05385d086943ca1b64cc246055c8b0cd71c65",
-    "https://storage.googleapis.com/public-bazel-artifacts/go/20240201-224012/go1.21.5.darwin-amd64.tar.gz": "9a9af12fddf7315db68ceeb2980d9cecbf058d50356787bc1680417d9c5892eb",
-    "https://storage.googleapis.com/public-bazel-artifacts/go/20240201-224012/go1.21.5.darwin-arm64.tar.gz": "7a5c1f1ca0831980ea06e7383a7e56af7665f8863bc923e19fd050c9fd4866a9",
-    "https://storage.googleapis.com/public-bazel-artifacts/go/20240201-224012/go1.21.5.linux-amd64.tar.gz": "7656c08487ea9d8817047be5698bf96a787c195e237d62c2d605ad754c55022d",
-    "https://storage.googleapis.com/public-bazel-artifacts/go/20240201-224012/go1.21.5.linux-arm64.tar.gz": "5ca30901c990538e21a8adf4a0945b013ecae34cfbfc3fbac893ac24c2c33c0c",
-    "https://storage.googleapis.com/public-bazel-artifacts/go/20240201-224012/go1.21.5.windows-amd64.tar.gz": "f32ad2e23031dc7e43db29dce7bf0cb1bba095760f96972ace094159f6bd2986",
-    "https://storage.googleapis.com/public-bazel-artifacts/go/20240201-224012/go1.21.5fips.linux-amd64.tar.gz": "33bc9129c5a9ebc3a5f6deb3e651f05216a035479404c849d443d0930aec2b6a",
+    "https://storage.googleapis.com/public-bazel-artifacts/go/20240220-195058/go1.21.5.darwin-amd64.tar.gz": "182c3e597111d474b29d72fbfee1ddb2915acd39b7c3e534a78eaddfa767089d",
+    "https://storage.googleapis.com/public-bazel-artifacts/go/20240220-195058/go1.21.5.darwin-arm64.tar.gz": "1894e6f86814cd882c51bb5a73cf1312551c734bd4ac9fb33866df2a50e1d1a0",
+    "https://storage.googleapis.com/public-bazel-artifacts/go/20240220-195058/go1.21.5.linux-amd64.tar.gz": "ff04d463bf9da03cfe6aefeff6039312c701f74ab291162b937b31026f262228",
+    "https://storage.googleapis.com/public-bazel-artifacts/go/20240220-195058/go1.21.5.linux-arm64.tar.gz": "9a09561064580e837af46bc314536b450bd2546985955ddf1e70699a4abe2fb6",
+    "https://storage.googleapis.com/public-bazel-artifacts/go/20240220-195058/go1.21.5.windows-amd64.tar.gz": "93375cd3e51b811297a52a0e7a9d98b126da3ae02daaabb5d423e1c496275f06",
+    "https://storage.googleapis.com/public-bazel-artifacts/go/20240220-195058/go1.21.5fips.linux-amd64.tar.gz": "68fefc15b4328244fe78f1269e8856a2a2cd52f1fb9f451bb8bc0c23d590fe14",
     "https://storage.googleapis.com/public-bazel-artifacts/java/railroad/rr-1.63-java8.zip": "d2791cd7a44ea5be862f33f5a9b3d40aaad9858455828ebade7007ad7113fb41",
     "https://storage.googleapis.com/public-bazel-artifacts/js/rules_jest-v0.18.4.tar.gz": "d3bb833f74b8ad054e6bff5e41606ff10a62880cc99e4d480f4bdfa70add1ba7",
     "https://storage.googleapis.com/public-bazel-artifacts/js/rules_js-v1.26.1.tar.gz": "08061ba5e5e7f4b1074538323576dac819f9337a0c7d75aee43afc8ae7cb6e18",

@aadityasondhi aadityasondhi force-pushed the 20240205.grunning-patch branch from 11fbe3d to 89289a8 Compare February 20, 2024 20:40
In our previous version of this patch, we missed two entry points and
one exit point into the grunning state of a Goroutine. This led to
`grunning.Time()` being non-monotonic.

This new patch adds those missing integration points.

Fixes cockroachdb#95529.

Release note: None
@aadityasondhi aadityasondhi force-pushed the 20240205.grunning-patch branch from 89289a8 to 6af173f Compare February 20, 2024 20:40
@aadityasondhi
Copy link
Collaborator Author

@aadityasondhi Go ahead and apply this diff and we'll see if CI is okay with this.

Build is looking good, feel free to bors if you think it is good to do so.

@aadityasondhi
Copy link
Collaborator Author

bors r=sumeerbhola,rickystewart

@craig
Copy link
Contributor

craig bot commented Feb 22, 2024

Build succeeded:

@craig craig bot merged commit 9e52705 into cockroachdb:master Feb 22, 2024
8 of 14 checks passed
@aadityasondhi aadityasondhi deleted the 20240205.grunning-patch branch February 22, 2024 17:43
aadityasondhi added a commit to aadityasondhi/cockroach that referenced this pull request Jun 28, 2024
This was fixed in cockroachdb#118907.

This patch adds an assertion for test builds to ensure monotonic
grunning time.

Informs cockroachdb#95529

Release note: None
craig bot pushed a commit that referenced this pull request Jul 2, 2024
126424: kvadmission: remove grunning non-monotonic comment r=aadityasondhi a=aadityasondhi

This was fixed in #118907.

This patch adds an assertion for test builds to ensure monotonic grunning time.

Informs #95529

Release note: None

Co-authored-by: Aaditya Sondhi <[email protected]>
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.

grunning: grunning.Time() is non-monotonic
4 participants