Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

goroutine leak in new metrics loop() #31244

Open
demon-xxi opened this issue Feb 24, 2025 · 1 comment · May be fixed by #31252
Open

goroutine leak in new metrics loop() #31244

demon-xxi opened this issue Feb 24, 2025 · 1 comment · May be fixed by #31252
Assignees
Labels

Comments

@demon-xxi
Copy link

Using go-ethereum library as depednecy in my app for some types parsing. Not running geth rtc..
When upgrading from 1.14.11 to 1.15.2 the goleak started screaming.

Look like this PR #30814 introduced loop() goroutine that always stay active. there is no way to stop it. Also for the code that only refers dependency library for type parsing it's unclear why whole metrics system is initialized now.

System information

go-ethereum version: v1.15.2

Expected behaviour

metrics are not initialized and no extra goroutines spawned

Actual behaviour

meter.go loop() keeps running in goroutine()

Steps to reproduce the behaviour

package main

import (
	"testing"

	"github.com/ethereum/go-ethereum/rpc"
	"go.uber.org/goleak"
)

func TestLeak(t *testing.T) {
	defer goleak.VerifyNone(t)
	println(rpc.LatestBlockNumber)
}

Backtrace

main_test.go:18: found unexpected goroutines:
        [Goroutine 3 in state chan receive, with github.com/ethereum/go-ethereum/metrics.(*meterTicker).loop on top of the stack:
        github.com/ethereum/go-ethereum/metrics.(*meterTicker).loop(0x104783420)
                /Users/demon/.gvm/pkgsets/go1.22.10/global/pkg/mod/github.com/ethereum/[email protected]/metrics/meter.go:159 +0x50
        created by github.com/ethereum/go-ethereum/metrics.(*meterTicker).add in goroutine 1
                /Users/demon/.gvm/pkgsets/go1.22.10/global/pkg/mod/github.com/ethereum/[email protected]/metrics/meter.go:145 +0xc8

When submitting logs: please submit them as text and not screenshots.

@demon-xxi
Copy link
Author

@jwasinger jwasinger self-assigned this Feb 25, 2025
@jwasinger jwasinger linked a pull request Feb 25, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants