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

Unable to perform graceful shutdown with new node #16790

Closed
bgrieder opened this issue May 23, 2018 · 0 comments
Closed

Unable to perform graceful shutdown with new node #16790

bgrieder opened this issue May 23, 2018 · 0 comments

Comments

@bgrieder
Copy link

bgrieder commented May 23, 2018

Hi,

I am using geth as a library (version: 1.8.8) and instantiating a new node on a (private) Clique network.

The node sets-up the Genesis block in the DB just fine.
When trying to shut down the node however, the node locks when trying to close the DB

The problem is that it is indefinitely waiting for quitChan in ethdb/database.go#Close():

if db.quitChan != nil {
	errc := make(chan error)
	db.quitChan <- errc    // <= This line
	if err := <-errc; err != nil {
		db.log.Error("Metrics collection failed", "err", err)
	}
}

The reason is that nothing is ever sent to quitChan because the function func (db *LDBDatabase) meter(refresh time.Duration) returns before ever using the channel.

Since the DB is new, the following test makes it return too early because leveldb.iostats does not exist

	ioStats, err := db.db.GetProperty("leveldb.iostats")
	if err != nil {
		db.log.Error("Failed to read database iostats", "err", err)
		return
	}

I believe, inside the if test, the statement db.quitChan = nil should be inserted to skip over the test in Close().

I guess the same reasoning applies to the test on leveldb.stats

(alternatively, why should missing levelddb.iostats cause the meter function to return, rather than the inner loop to continue?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant