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

Fatal: Failed to register the Ethereum service #25848

Closed
Ericalvin opened this issue Sep 22, 2022 · 11 comments
Closed

Fatal: Failed to register the Ethereum service #25848

Ericalvin opened this issue Sep 22, 2022 · 11 comments

Comments

@Ericalvin
Copy link

Hello every .
When I restart my host , I found my geth log say :
Fatal: Failed to register the Ethereum service: gap (#5734246) in the chain between ancients and leveldb

what can i do to fix, thank you.

my geth version:1.10.25

@holiman
Copy link
Contributor

holiman commented Sep 22, 2022

Could you please provide
geth db metadata (if you have any special arguments like --datadir, or --goerli, you need to provide those too).
Also the boot-up log from starting geth, maybe ~150 lines or so,

@Ericalvin
Copy link
Author

Ericalvin commented Sep 23, 2022

@holiman hi , below is info
use:
geth --authrpc.addr localhost --authrpc.port 8551 --authrpc.vhosts localhost --authrpc.jwtsecret /data/geth/jwtsecret --ignore-legacy-receipts --http --http.port 8545 --http.addr "0.0.0.0" --http.vhosts '*' --ws --ws.port 8546 --ws.addr "0.0.0.0" --ws.origins '*' --http.api web3,eth,txpool --datadir /data --cache 12288

log:

Sep 23 01:19:51 systemd[1]: Stopped Ethereum go client.
Sep 23 03:29:06 systemd[1]: Started Ethereum go client.
Sep 23 03:29:06 geth[19712]: INFO [09-23|03:29:06.916] Starting Geth on Ethereum mainnet...
Sep 23 03:29:06 geth[19712]: INFO [09-23|03:29:06.918] Maximum peer count                       ETH=50 LES=0 total=50
Sep 23 03:29:06 geth[19712]: INFO [09-23|03:29:06.919] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
Sep 23 03:29:06 geth[19712]: WARN [09-23|03:29:06.919] Found deprecated node list file /data/geth/static-nodes.json, please use the TOML config file instead.
Sep 23 03:29:06 geth[19712]: WARN [09-23|03:29:06.920] Sanitizing cache to Go's GC limits       provided=12288 updated=5181
Sep 23 03:29:06 geth[19712]: INFO [09-23|03:29:06.921] Set global gas cap                       cap=50,000,000
Sep 23 03:29:06 geth[19712]: INFO [09-23|03:29:06.923] Allocated trie memory caches             clean=777.00MiB dirty=1.26GiB
Sep 23 03:29:06 geth[19712]: INFO [09-23|03:29:06.923] Allocated cache and file handles         database=/data/geth/chaindata cache=2.53GiB handles=2048
Sep 23 03:29:11 geth[19712]: INFO [09-23|03:29:11.393] Found legacy ancient chain path          location=/data/geth/chaindata/ancient
Sep 23 03:29:11 geth[19712]: INFO [09-23|03:29:11.394] Opened ancient database                  database=/data/geth/chaindata/ancient readonly=false
Sep 23 03:29:11 geth[19712]: Fatal: Failed to register the Ethereum service: gap (#5734246) in the chain between ancients and leveldb
Sep 23 03:29:11 systemd[1]: geth.service: Main process exited, code=exited, status=1/FAILURE
Sep 23 03:29:11 systemd[1]: geth.service: Failed with result 'exit-code'

@holiman
Copy link
Contributor

holiman commented Sep 23, 2022 via email

@Ericalvin
Copy link
Author

Ericalvin commented Sep 23, 2022

@holiman when i use geth db metadata --datadir /data , it show this the same with start log

INFO [09-23|05:47:07.745] Maximum peer count                       ETH=50 LES=0 total=50
INFO [09-23|05:47:07.745] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
WARN [09-23|05:47:07.746] Found deprecated node list file /data/geth/static-nodes.json, please use the TOML config file instead. 
INFO [09-23|05:47:07.746] Set global gas cap                       cap=50,000,000
INFO [09-23|05:47:07.746] Allocated cache and file handles         database=/data/geth/chaindata cache=512.00MiB handles=524,288 readonly=true
INFO [09-23|05:47:10.174] Found legacy ancient chain path          location=/data/geth/chaindata/ancient
INFO [09-23|05:47:10.175] Opened ancient database                  database=/data/geth/chaindata/ancient readonly=true
Fatal: Could not open database: gap (#5734246) in the chain between ancients and leveldb

@holiman
Copy link
Contributor

holiman commented Sep 23, 2022

OK. I have no idea why this occurred. My guess is that the fastest and least painful way to move forward would be to do a fresh sync (clean database via geth --datadir /data removedb).

@holiman
Copy link
Contributor

holiman commented Sep 23, 2022

Note to self, we should apply this diff

diff --git a/core/rawdb/database.go b/core/rawdb/database.go
index 1eaf033bbe..a47d9bf46e 100644
--- a/core/rawdb/database.go
+++ b/core/rawdb/database.go
@@ -240,8 +240,8 @@ func NewDatabaseWithFreezer(db ethdb.KeyValueStore, ancient string, namespace st
                        if kvhash, _ := db.Get(headerHashKey(frozen)); len(kvhash) == 0 {
                                // Subsequent header after the freezer limit is missing from the database.
                                // Reject startup if the database has a more recent head.
-                               if *ReadHeaderNumber(db, ReadHeadHeaderHash(db)) > frozen-1 {
-                                       return nil, fmt.Errorf("gap (#%d) in the chain between ancients and leveldb", frozen)
+                               if ldbNum := *ReadHeaderNumber(db, ReadHeadHeaderHash(db)); ldbNum > frozen-1 {
+                                       return nil, fmt.Errorf("gap in the chain between ancients (#%d) and leveldb (#%d)", frozen, ldbNum)
                                }
                                // Database contains only older data than the freezer, this happens if the
                                // state was wiped and reinited from an existing freezer.

@Ericalvin
Copy link
Author

Ericalvin commented Sep 23, 2022

@holiman OK, so i use geth --datadir /data removedb
is this type "y" ? remove full mode?
Remove full node state database (/data/geth/chaindata)? [y/n]

@holiman
Copy link
Contributor

holiman commented Sep 23, 2022

yes, and you can answer yes to all

@Cyberarray
Copy link

Cyberarray commented Sep 23, 2022

That should wipe out the blockchain itself and let you sync from scratch. and Also you probably want to do a fast sync afterwards on the chain you can use --fast

@holiman
Copy link
Contributor

holiman commented Sep 23, 2022

Also you probably want to do a fast sync afterwards on the chain you can use --fast

syncmode=fast is not supported in geth anymore. syncmode=snap is default and does not need to be explicitly spelled out.

@Ericalvin
Copy link
Author

@holiman ok, it start sync from begin, thank you.
@Cyberarray thanks too.

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

4 participants