WIP: rebase fork onto upstream/main (v1.103.0) #15

Closed
codinget wants to merge 670 commits from webnet into save/webnet-2026-07-29
4 changed files with 0 additions and 66 deletions
Showing only changes of commit 4aef023765 - Show all commits
-3
View File
@@ -460,9 +460,6 @@ func run() (err error) {
return nil
}
if envknob.Bool("TS_DEBUG_MEMORY") {
logf = logger.RusagePrefixLog(logf)
}
logf = logger.RateLimitedFn(logf, 5*time.Second, 5, 100)
if envknob.Bool("TS_PLEASE_PANIC") {
-23
View File
@@ -1,23 +0,0 @@
// Copyright (c) Tailscale Inc & contributors
// SPDX-License-Identifier: BSD-3-Clause
package logger
import (
"fmt"
"runtime"
)
// RusagePrefixLog returns a Logf func wrapping the provided logf func that adds
// a prefixed log message to each line with the current binary memory usage
// and max RSS.
func RusagePrefixLog(logf Logf) Logf {
return func(f string, argv ...any) {
var m runtime.MemStats
runtime.ReadMemStats(&m)
goMem := float64(m.HeapInuse+m.StackInuse) / (1 << 20)
maxRSS := rusageMaxRSS()
pf := fmt.Sprintf("%.1fM/%.1fM %s", goMem, maxRSS, f)
logf(pf, argv...)
}
}
-11
View File
@@ -1,11 +0,0 @@
// Copyright (c) Tailscale Inc & contributors
// SPDX-License-Identifier: BSD-3-Clause
//go:build windows || wasm || plan9 || tamago
package logger
func rusageMaxRSS() float64 {
// TODO(apenwarr): Substitute Windows equivalent of Getrusage() here.
return 0
}
-29
View File
@@ -1,29 +0,0 @@
// Copyright (c) Tailscale Inc & contributors
// SPDX-License-Identifier: BSD-3-Clause
//go:build !windows && !wasm && !plan9 && !tamago
package logger
import (
"runtime"
"golang.org/x/sys/unix"
)
func rusageMaxRSS() float64 {
var ru unix.Rusage
err := unix.Getrusage(unix.RUSAGE_SELF, &ru)
if err != nil {
return 0
}
rss := float64(ru.Maxrss)
if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
rss /= 1 << 20 // ru_maxrss is bytes on darwin
} else {
// ru_maxrss is kilobytes elsewhere (linux, openbsd, etc)
rss /= 1 << 10
}
return rss
}