Coder Social home page Coder Social logo

Comments (9)

mknyszek avatar mknyszek commented on May 30, 2024 3

I think I found the bug. The span can be freed (and the "bytes in heap" stats can be updated) before we update the object stats for large objects on sweep. The subtraction assumes that object stats are always handled before the "bytes in heap" stat.

from go.

felixge avatar felixge commented on May 30, 2024 1

I've checked and think I can rule out arena usage. There are no search hits for arena imports in our mono-repo, and we're seeing this issue across most of our services.

Any other ideas for things we could do to help debug this? Do you have a chance to see if the issue happens with Google's fleet? It's possible we're doing something weird, but I'm not sure what 🤔 . This is the only memory metric that we see behave oddly like this.

from go.

mknyszek avatar mknyszek commented on May 30, 2024

Hm... those differences are so large (300+ MiB??) that it doesn't seem like a situation where we're transiently racy in some corner case (as is the usual case for accounting bugs). It's a bit difficult to explain this.

This is a shot in the dark, but is it possible these services are using GOEXPERIMENT=arenas? That's maybe the one area where I could see both (1) skew this large and (2) accounting bugs still lurk, because it's used less widely.

from go.

gopherbot avatar gopherbot commented on May 30, 2024

Change https://go.dev/cl/583380 mentions this issue: runtime: update large object stats before freeSpan in sweep

from go.

mknyszek avatar mknyszek commented on May 30, 2024

@gopherbot Please open backport issues for Go 1.21 and Go 1.22.

This issue can cause spurious overflow in runtime metrics with no workaround.

from go.

gopherbot avatar gopherbot commented on May 30, 2024

Backport issue(s) opened: #67187 (for 1.21), #67188 (for 1.22).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases.

from go.

mknyszek avatar mknyszek commented on May 30, 2024

Reproducer:

package main

import (
	"runtime/metrics"
)

var sink any

func main() {
	go func() {
		s := []metrics.Sample{
			{Name: "/memory/classes/heap/unused:bytes"},
		}
		for {
			metrics.Read(s)
			val := s[0].Value.Uint64()
			if val > 1<<40 {
				panic("overflow")
			}
		}
	}()
	for {
		sink = make([]byte, 10<<20)
		sink = nil
	}
}

from go.

gopherbot avatar gopherbot commented on May 30, 2024

Change https://go.dev/cl/584337 mentions this issue: [relase-branch.go1.21] runtime: update large object stats before freeSpan in sweep

from go.

gopherbot avatar gopherbot commented on May 30, 2024

Change https://go.dev/cl/584339 mentions this issue: [relase-branch.go1.22] runtime: update large object stats before freeSpan in sweep

from go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.