diff options
| author | Camden McGath <camdenlmcgath@gmail.com> | 2025-08-10 22:23:39 -0600 |
|---|---|---|
| committer | Michael Knyszek <mknyszek@google.com> | 2025-08-21 14:53:58 -0700 |
| commit | 36619de9bce2c79e1180945ae14403c01eca0053 (patch) | |
| tree | 105c31fa05345f14fe1cab6240ec49ed2754504c | |
| parent | 172158e1b6b5fa798ef07251c9a8cff6f3c42e19 (diff) | |
| download | go-x-website-36619de9bce2c79e1180945ae14403c01eca0053.tar.xz | |
runtime: document that cleanups, finalizers can hold up other cleanups, finalizers.
Explicit documentation was added to the GC Guide common issues for finalizers and cleanups
since they can block other finalizers and cleanups. Language indicating the solution
of using another goroutine in these cases was already included in the finalizer and
cleanup documentation. This documentation was used as the model for these changes.
Fixes golang/go#72950
Change-Id: Iea9f558f8f5f44153fbe2dfba918a17ebed15c68
Reviewed-on: https://go-review.googlesource.com/c/website/+/694516
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
| -rw-r--r-- | _content/doc/gc-guide.html | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/_content/doc/gc-guide.html b/_content/doc/gc-guide.html index 1e7e2579..1be68201 100644 --- a/_content/doc/gc-guide.html +++ b/_content/doc/gc-guide.html @@ -1234,6 +1234,13 @@ runtime.AddCleanup(f, func(f *myFile) { Finalizers have a well-defined execution order, but cleanups do not. Cleanups can also run concurrently with one another. </p> + + </li> + <li> + <p> + Long running cleanups should create a goroutine to avoid + blocking the execution of other cleanups. + </p> </li> <li> <p> @@ -1327,6 +1334,12 @@ for range 10 { may end up relying on. </p> </li> + <li> + <p> + Long running finalizers should create a new goroutine + to avoid blocking the execution of other finalizers. + </p> + </li> <li> <p> <code>runtime.GC</code> will not wait until finalizers for unreachable |
