From e9d4b1fe7759a837b9316e7287f05009ba13d9ea Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Sun, 1 Mar 2026 23:37:15 +0200 Subject: [PATCH] limit the debug stack trace of FireAndForget to 2kb --- CHANGELOG.md | 6 ++++-- tools/routine/routine.go | 9 ++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2548dedd..13a004e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,11 @@ - Documented the `unmarshal` JSVM helper ([#7543](https://github.com/pocketbase/pocketbase/issues/7543)). -- Added extra existence check after the `Store.GetOrSet` write lock to prevent races overwriting an already existing value. +- Added extra read check after the `Store.GetOrSet` write lock to prevent races overwriting an already existing value. -- Added empty check for the additional client-side relation filter ListRule constraint to properly resolve OR like statements ([presentator#206](https://github.com/presentator/presentator/issues/206)). +- Added empty records check for the additional client-side filter's ListRule constraint that was introduced in v0.32.0 ([presentator#206](https://github.com/presentator/presentator/issues/206)). + +- Set a fixed `routine.FireAndForget()` debug stack trace limit to 2KB. - (@todo) Bumped min Go GitHub action version to 1.26.1 because it comes with some [security fixes](https://github.com/golang/go/issues?q=milestone%3AGo1.26.1). diff --git a/tools/routine/routine.go b/tools/routine/routine.go index afddd30f..87913885 100644 --- a/tools/routine/routine.go +++ b/tools/routine/routine.go @@ -2,7 +2,7 @@ package routine import ( "log" - "runtime/debug" + "runtime" "sync" ) @@ -22,8 +22,11 @@ func FireAndForget(f func(), wg ...*sync.WaitGroup) { defer func() { if err := recover(); err != nil { - log.Printf("RECOVERED FROM PANIC (safe to ignore): %v", err) - log.Println(string(debug.Stack())) + log.Println("RECOVERED FROM PANIC (safe to ignore):", err) + + stack := make([]byte, 2<<10) // 2 KB + length := runtime.Stack(stack, false) + log.Println(string(stack[:length])) } }()