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

Failed to flush frozen tables when try re-init #27981

Closed
anhnh131 opened this issue Aug 23, 2023 · 2 comments
Closed

Failed to flush frozen tables when try re-init #27981

anhnh131 opened this issue Aug 23, 2023 · 2 comments

Comments

@anhnh131
Copy link

I am using Geth to build a POA network. When I try re-init geth (after updating the genesis config), I received the error (CRIT: Failed to flush frozen tables) the first time. That seems like an "unclean shutdown" https://geth.ethereum.org/docs/fundamentals/databases#unclean-shutdowns.
How can check it clean shutdown successfully?
Note: I tried waiting for about 10 minutes after stopping and running geth init, but it still fails the first time ( my network only has about 250k blocks)

System information

  • Geth version: v1.10.18
  • OS & Version: Docker

Steps to reproduce the behavior

$ sudo docker stop -t 300 geth
geth

$ sudo docker run --rm -v /data/ethereum:/data/ethereum ethereum/client-go:v1.10.18 --verbosity 5 init --datadir=/data/ethereum /data/ethereum/genesis.json
INFO [08-23|07:11:26.840] Maximum peer count                       ETH=50 LES=0 total=50
INFO [08-23|07:11:26.840] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
DEBUG[08-23|07:11:26.841] FS scan times                            list="33.088µs" set="8.09µs" diff="2.501µs"
TRACE[08-23|07:11:26.841] Handled keystore changes                 time="90.767µs"
TRACE[08-23|07:11:26.841] Started watching keystore folder         path=/data/ethereum/keystore
DEBUG[08-23|07:11:26.842] Sanitizing Go's GC trigger               percent=100
INFO [08-23|07:11:26.842] Set global gas cap                       cap=50,000,000
INFO [08-23|07:11:26.842] Allocated cache and file handles         database=/data/ethereum/geth/chaindata cache=16.00MiB handles=16
DEBUG[08-23|07:11:26.862] Chain freezer table opened               database=/data/ethereum/geth/chaindata/ancient table=headers items=191,396 size=56.90MiB
DEBUG[08-23|07:11:26.862] Chain freezer table opened               database=/data/ethereum/geth/chaindata/ancient table=hashes  items=191,396 size=5.84MiB
DEBUG[08-23|07:11:26.863] Chain freezer table opened               database=/data/ethereum/geth/chaindata/ancient table=bodies  items=191,396 size=935.33KiB
DEBUG[08-23|07:11:26.868] Chain freezer table opened               database=/data/ethereum/geth/chaindata/ancient table=receipts items=191,396 size=560.77KiB
DEBUG[08-23|07:11:26.871] Chain freezer table opened               database=/data/ethereum/geth/chaindata/ancient table=diffs    items=191,396 size=706.67KiB
INFO [08-23|07:11:26.871] Opened ancient database                  database=/data/ethereum/geth/chaindata/ancient readonly=false
INFO [08-23|07:11:26.899] Persisted trie from memory database      nodes=355 size=50.41KiB  time=2.231182ms gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
CRIT [08-23|07:11:26.902] Failed to flush frozen tables            err="[invalid argument]"

$ sudo docker run --rm -v /data/ethereum:/data/ethereum ethereum/client-go:v1.10.18 --verbosity 5 init --datadir=/data/ethereum /data/ethereum/genesis.json
INFO [08-23|07:11:35.386] Maximum peer count                       ETH=50 LES=0 total=50
INFO [08-23|07:11:35.386] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
TRACE[08-23|07:11:35.386] Started watching keystore folder         path=/data/ethereum/keystore
DEBUG[08-23|07:11:35.386] FS scan times                            list="29.377µs" set="8.173µs" diff="2.551µs"
TRACE[08-23|07:11:35.386] Handled keystore changes                 time="52.914µs"
DEBUG[08-23|07:11:35.386] Sanitizing Go's GC trigger               percent=100
INFO [08-23|07:11:35.386] Set global gas cap                       cap=50,000,000
INFO [08-23|07:11:35.387] Allocated cache and file handles         database=/data/ethereum/geth/chaindata cache=16.00MiB handles=16
DEBUG[08-23|07:11:35.399] Chain freezer table opened               database=/data/ethereum/geth/chaindata/ancient table=hashes items=191,446 size=5.84MiB
DEBUG[08-23|07:11:35.400] Chain freezer table opened               database=/data/ethereum/geth/chaindata/ancient table=bodies items=191,446 size=935.57KiB
DEBUG[08-23|07:11:35.401] Chain freezer table opened               database=/data/ethereum/geth/chaindata/ancient table=receipts items=191,446 size=560.92KiB
DEBUG[08-23|07:11:35.402] Chain freezer table opened               database=/data/ethereum/geth/chaindata/ancient table=diffs    items=191,446 size=706.86KiB
DEBUG[08-23|07:11:35.404] Chain freezer table opened               database=/data/ethereum/geth/chaindata/ancient table=headers  items=191,446 size=56.92MiB
INFO [08-23|07:11:35.405] Opened ancient database                  database=/data/ethereum/geth/chaindata/ancient readonly=false
DEBUG[08-23|07:11:35.412] Ancient blocks frozen already            number=281,445 hash=623176..c5a59e frozen=191,446
INFO [08-23|07:11:35.416] Persisted trie from memory database      nodes=355 size=50.41KiB  time="864.965µs" gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [08-23|07:11:35.448] Successfully wrote genesis state         database=chaindata                             hash=960aa6..e46774
INFO [08-23|07:11:35.448] Allocated cache and file handles         database=/data/ethereum/geth/lightchaindata    cache=16.00MiB handles=16
DEBUG[08-23|07:11:35.458] Chain freezer table opened               database=/data/ethereum/geth/lightchaindata/ancient table=diffs    items=0       size=0.00B
DEBUG[08-23|07:11:35.458] Chain freezer table opened               database=/data/ethereum/geth/lightchaindata/ancient table=headers  items=0       size=0.00B
DEBUG[08-23|07:11:35.458] Chain freezer table opened               database=/data/ethereum/geth/lightchaindata/ancient table=hashes   items=0       size=0.00B
DEBUG[08-23|07:11:35.458] Chain freezer table opened               database=/data/ethereum/geth/lightchaindata/ancient table=bodies   items=0       size=0.00B
DEBUG[08-23|07:11:35.459] Chain freezer table opened               database=/data/ethereum/geth/lightchaindata/ancient table=receipts items=0       size=0.00B
INFO [08-23|07:11:35.459] Opened ancient database                  database=/data/ethereum/geth/lightchaindata/ancient readonly=false
DEBUG[08-23|07:11:35.459] Current full block not old enough        number=0       hash=960aa6..e46774 delay=90000
INFO [08-23|07:11:35.464] Persisted trie from memory database      nodes=355 size=50.41KiB  time=1.260342ms  gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [08-23|07:11:35.466] Successfully wrote genesis state         database=lightchaindata                        hash=960aa6..e46774
@holiman
Copy link
Contributor

holiman commented Aug 23, 2023

Hi,
The latest geth-release is 1.12.2, your version v1.10.18 is about 15 months old, and we cannot provide support for such old releases -- when doing so, more often than not, we just rediscover bugs that were fixed in the meantime.
Please test with the latest version of geth, and see if the problem remains.

@holiman holiman closed this as completed Aug 23, 2023
@anhnh131
Copy link
Author

anhnh131 commented Aug 27, 2023

@holiman, Hi, thank you for supporting me.
I checked, and this error usually happens on Geth v1.10.18.

  • less than or equal to v1.10.17 works fine
  • greater than or equal to v1.11.0 works fine

Sorry for my inconvenience. Because my private network has many nodes in v1.10.18, I want to know what happens in this version. I researched, but I don't know why. I think that because I don't have much experience with Go. I think it can come from #24684.
I have a question, For a workaround, can I use the code below? With n about 3, it means try to init about 3 times.

loop(n times){
    try{
        geth init
        break;
    }catch(){
        // do nothing
    }
}

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

2 participants