panic: runtime error: wrong error handling in newStateDB
【问题分类】
- bug
- P2P网络相关(包含libp2p,liquid)
- 链账户身份与权限相关(证书问题、public、多签投票问题)
- 核心交易引擎相关(交易池、DAG)
- 共识相关
- 智能合约相关
- 存储相关
- SDK相关
- 长安链CMC工具
- 长安链管理台
- 长安链浏览器
- 长安链合约IDE
- 长安链web签名插件
- 跨链相关
- 轻节点相关
- 隐私计算相关
- 密码学相关
- 环境依赖
- 其他补充:
【问题描述】(请对问题进行描述,方便定位问题)
At line 340, there is a call to addCacheForDBHandler
. When addCacheForDBHandler
returns an error (err
), this error is handled, and dbHandler.Close()
is called. However, dbHandler
is nil
when err
is not nil
, causing a panic.
Modifying the node configuration storage.state_cache_config.hard_max_cache_size
in chainmaker.yml
to a value less than 0 can trigger this issue.
【相关日志文件】(如果有报错日志请贴图,或者上传附件)
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x28be2f1]
goroutine 1 [running]:
chainmaker.org/chainmaker/store/v2.(*storeBuilder).newStateDB(0xc00112dc00)
/root/go/pkg/mod/chainmaker.org/chainmaker/store/v2@v2.3.6/store_builder.go:341 +0x291
chainmaker.org/chainmaker/store/v2.(*storeBuilder).registerAllKnownCreators.func2()
/root/go/pkg/mod/chainmaker.org/chainmaker/store/v2@v2.3.6/store_builder.go:93 +0x1d
chainmaker.org/chainmaker/store/v2.(*storeBuilder).toCreator.func1({0x2e619a0?, 0xc00112dc78})
/root/go/pkg/mod/chainmaker.org/chainmaker/store/v2@v2.3.6/store_builder.go:157 +0x44
chainmaker.org/chainmaker/store/v2.(*storeBuilder).create(0xc00112dc00, {0x2e619a0, 0xc00112dc78})
/root/go/pkg/mod/chainmaker.org/chainmaker/store/v2@v2.3.6/store_builder.go:182 +0xc2
chainmaker.org/chainmaker/store/v2.(*storeBuilder).Build(0xc00112dc00)
/root/go/pkg/mod/chainmaker.org/chainmaker/store/v2@v2.3.6/store_builder.go:239 +0x471
chainmaker.org/chainmaker/store/v2.(*Factory).NewStore(0xc000cffa80?, {0xc0004f4450?, 0x10?}, 0x31d19e0?, {0x38a3cc8?, 0xc001300230?}, 0x10c4e7e?)
/root/go/pkg/mod/chainmaker.org/chainmaker/store/v2@v2.3.6/store_factory.go:91 +0x3f
reflect.Value.call({0x300d5a0?, 0xc00127d780?, 0xc00127d840?}, {0x32e4fd9, 0x4}, {0xc001252660, 0x4, 0x3187480?})
/usr/local/go/src/reflect/value.go:584 +0x8c5
reflect.Value.Call({0x300d5a0?, 0xc00127d780?, 0xc00127d780?}, {0xc001252660?, 0xc001120990?, 0xc000d001f8?})
/usr/local/go/src/reflect/value.go:368 +0xbc
chainmaker.org/chainmaker/common/v2/container.(*Container).invoke(0xd0?, {0x300d5a0?, 0xc00127d780}, 0x20?, 0x38ab1f0?, 0x328ca80?)
/root/go/pkg/mod/chainmaker.org/chainmaker/common/v2@v2.3.4/container/container.go:307 +0x10f
chainmaker.org/chainmaker/common/v2/container.(*binding).resolve(0xc0013003f0, 0x38ab1f0?)
/root/go/pkg/mod/chainmaker.org/chainmaker/common/v2@v2.3.4/container/container.go:71 +0x4c
chainmaker.org/chainmaker/common/v2/container.(*Container).Resolve(0xc0002199e0?, {0x2e601e0?, 0xc0011221d8}, {0xc000d004e0, 0x1, 0x38?})
/root/go/pkg/mod/chainmaker.org/chainmaker/common/v2@v2.3.4/container/container.go:354 +0x41c
chainmaker.org/chainmaker/common/v2/container.Resolve(...)
/root/go/pkg/mod/chainmaker.org/chainmaker/common/v2@v2.3.4/container/container.go:477
chainmaker.org/chainmaker-go/module/blockchain.(*Blockchain).initStore(0xc001122180)
/root/chainmaker-go/module/blockchain/blockchain_init.go:261 +0x487
chainmaker.org/chainmaker-go/module/blockchain.(*Blockchain).initBaseModules(0xc001122180, {0xc014218840, 0x5, 0x8?})
/root/chainmaker-go/module/blockchain/blockchain_init.go:185 +0x1db
chainmaker.org/chainmaker-go/module/blockchain.(*Blockchain).Init(0xc001122180)
/root/chainmaker-go/module/blockchain/blockchain_init.go:78 +0x6e7
chainmaker.org/chainmaker-go/module/blockchain.(*ChainMakerServer).initBlockchain(0xc00111a680, {0xc0004f4450, 0x6}, {0xc000262a80?, 0xc000013f20?})
/root/chainmaker-go/module/blockchain/chainmaker_server.go:298 +0x385
chainmaker.org/chainmaker-go/module/blockchain.(*ChainMakerServer).initBlockchains(0xc00111a680)
/root/chainmaker-go/module/blockchain/chainmaker_server.go:215 +0xf0
chainmaker.org/chainmaker-go/module/blockchain.(*ChainMakerServer).Init(0xc00111a680)
/root/chainmaker-go/module/blockchain/chainmaker_server.go:67 +0xca
chainmaker.org/chainmaker-go/main/cmd.mainStart()
/root/chainmaker-go/main/cmd/cli_start.go:56 +0x55
chainmaker.org/chainmaker-go/main/cmd.StartCMD.func1(0xc0007f4500?, {0x32e5729?, 0x3?, 0x3?})
/root/chainmaker-go/main/cmd/cli_start.go:40 +0x1e
github.com/spf13/cobra.(*Command).execute(0xc0007f4500, {0xc0010d9350, 0x3, 0x3})
/root/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:852 +0x67c
github.com/spf13/cobra.(*Command).ExecuteC(0xc00022ea00)
/root/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:960 +0x39d
github.com/spf13/cobra.(*Command).Execute(...)
/root/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:897
main.main()
/root/chainmaker-go/main/main.go:24 +0xf5
【系统信息】(请填写系统信息,方便定位问题)
- chainmaker-go version * : [v2.3.4]
- OS & version * : ubuntu-22.04.3-live-server-amd64, Linux version 5.15.0-119-generic
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information