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

Geth uses 100% CPU even with 1 thread active #20161

Closed
opelykhtabia opened this issue Oct 10, 2019 · 4 comments
Closed

Geth uses 100% CPU even with 1 thread active #20161

opelykhtabia opened this issue Oct 10, 2019 · 4 comments

Comments

@opelykhtabia
Copy link

System information

Geth version: 1.9.6
OS & Version: Linux (Ubuntu 18.04)
Commit hash : bd05968

Expected behaviour

Only 1 thread is used.

Actual behaviour

All CPU threads (8) are used with a 100% load.

Steps to reproduce the behaviour

Run geth with parameters
--mine --minerthreads "1"
or
--mine --minerthreads 1

@jeffwalsh
Copy link
Contributor

jeffwalsh commented Oct 13, 2019

That command is deprecrated:

MinerLegacyThreadsFlag = cli.IntFlag{
		Name:  "minerthreads",
		Usage: "Number of CPU threads to use for mining (deprecated, use --miner.threads)",
		Value: 0,
	}

Use geth --mine --miner.threads=1 instead I believe.

@jeffwalsh
Copy link
Contributor

jeffwalsh commented Oct 17, 2019

actually, the legacy one should still work, so i dont know if that would resolve your issue.
it says its deprected but its still used unless --miner.threads is also used
in cmd/geth/main.go:

		threads := ctx.GlobalInt(utils.MinerLegacyThreadsFlag.Name)
		if ctx.GlobalIsSet(utils.MinerThreadsFlag.Name) {
			threads = ctx.GlobalInt(utils.MinerThreadsFlag.Name)
		}

@karalabe
Copy link
Member

Ah, I think I know what the issue is. It's probably still constructing the mining DAG. That takes a few minutes and it's multi-threaded, so it will use up all your cores until it finishes. Mining itself will be single threaded afterwards.

You can verify by looking at the logs. If it prints something along the lines of Generating DAG in progress, it's still building the dataset on multiple threads.

@holiman
Copy link
Contributor

holiman commented Oct 17, 2019

Verified that when you already have the dag, it's only one processor at 100%

@holiman holiman closed this as completed Oct 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants