limit the debug stack trace of FireAndForget to 2kb

This commit is contained in:
Gani Georgiev
2026-03-01 23:37:15 +02:00
parent 9cefd0128c
commit e9d4b1fe77
2 changed files with 10 additions and 5 deletions

View File

@@ -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).

View File

@@ -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]))
}
}()