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 copydb (panic: runtime error: memory) #15858

Closed
MysticRyuujin opened this issue Jan 11, 2018 · 4 comments
Closed

Unable to perform copydb (panic: runtime error: memory) #15858

MysticRyuujin opened this issue Jan 11, 2018 · 4 comments
Assignees

Comments

@MysticRyuujin
Copy link
Contributor

System information

Geth version: Geth/v1.7.3-stable-4bb3c89d/linux-amd64/go1.9
OS & Version: Ubuntu 16.04.3 x64

I was following @karalabe 's instructions in #15797 and I got to block number 2433095 when geth crashed:

Command I ran geth --datadir=/gethswap copydb --cache=512 /geth/.ethereum/geth/chaindata

INFO [01-11|15:34:00] Imported new block receipts              count=283  elapsed=128.139ms bytes=817740   number=2433095 hash=65693e…3957ec ignored=0

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa45f88]

goroutine 58 [running]:
github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).fetchHeaders(0xc420216680, 0xc42025ce10, 0x258001, 0x0, 0x0)
        /build/ethereum-ZSPmrv/ethereum-1.7.3+build11486+xenial/build/_workspace/src/github.com/ethereum/go-ethereum/eth/downloader/downloader.go:859 +0xf18
github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).syncWithPeer.func3(0x8, 0xffd8b0)
        /build/ethereum-ZSPmrv/ethereum-1.7.3+build11486+xenial/build/_workspace/src/github.com/ethereum/go-ethereum/eth/downloader/downloader.go:474 +0x40
github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).spawnSync.func1(0xc42c1a5ee0, 0xc420062c60, 0xc42851f3a0)
        /build/ethereum-ZSPmrv/ethereum-1.7.3+build11486+xenial/build/_workspace/src/github.com/ethereum/go-ethereum/eth/downloader/downloader.go:500 +0x51
created by github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).spawnSync
        /build/ethereum-ZSPmrv/ethereum-1.7.3+build11486+xenial/build/_workspace/src/github.com/ethereum/go-ethereum/eth/downloader/downloader.go:500 +0xc7

root@GETH01:/# free -h
              total        used        free      shared  buff/cache   available
Mem:           7.8G         64M        2.3G        516K        5.4G        7.4G
Swap:          4.0G         30M        4.0G

root@GETH01:/# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G     0  3.9G   0% /dev
tmpfs           797M  8.8M  788M   2% /run
/dev/sda1       193G  174G  9.8G  95% /
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sdb1        99G  4.6G   89G   5% /gethswap
tmpfs           797M     0  797M   0% /run/user/1000
@MysticRyuujin
Copy link
Contributor Author

Possibly the same as #15796

@porpoisepor
Copy link

porpoisepor commented Jan 29, 2018

I stumbled upon #15797 too and tried to get geth to "fast sync" with itself. It seems to have caused the same problem here.
This feature seemed just too good to be true! Or at least too good for people with small SSDs which is my case.

In my case it crashed around block 4253696 the first time. I happened to run the command with more cache (1024) than the OP. I also ran the command a second time with 2048 cache and it just crashed much faster around block 1048576, so that doesn't seem to make any difference.
Edit: Also it crashed even faster with 4096 cache at block 417024. Coincidence maybe?

The contents of M:\temp_ethereum_swap were removed inbetween each test.
Full command: "C:\Ethereum Wallet\binaries\Geth\unpacked\geth.exe" --datadir=M:\temp_ethereum_swap copydb --cache=1024 C:\Ethereum\geth\chaindata

geth version output:

Version: 1.7.2-stable
Git Commit: 1db4ecdc0b9e828ff65777fb466fc7c1d04e0de9
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.9
Operating System: windows
GOPATH=
GOROOT=c:\go

OS: Windows 10 Pro

End of the output when using 1024 cache:

INFO [01-29|16:15:03] Imported new block headers               count=2048 elapsed=3.481s     number=4253696 hash=e3597f…fb2161 ignored=0
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0xa41cb7]

goroutine 66 [running]:
github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).fetchParts(0xc0420529c0, 0x15c9820, 0xc04202b340, 0xc0420386c0, 0xc1afc740a0, 0xc1a82c7490, 0xc0938439e8, 0xc093843a28, 0xc093843a18, 0xfbcc78, ...)
        C:/gopath/src/github.com/ethereum/go-ethereum/eth/downloader/downloader.go:1074 +0x657
github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).fillHeaderSkeleton(0xc0420529c0, 0x41a001, 0xc0cecde400, 0x80, 0x80, 0x4, 0x6000, 0x6000, 0x0, 0x0, ...)
        C:/gopath/src/github.com/ethereum/go-ethereum/eth/downloader/downloader.go:904 +0x384
github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).fetchHeaders(0xc0420529c0, 0xc0421810e0, 0x41a001, 0x0, 0x0)
        C:/gopath/src/github.com/ethereum/go-ethereum/eth/downloader/downloader.go:835 +0xa74
github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).syncWithPeer.func3(0x8, 0xfbee20)
        C:/gopath/src/github.com/ethereum/go-ethereum/eth/downloader/downloader.go:474 +0x47
github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).spawnSync.func1(0xc05a520450, 0xc05d2386c0, 0xc04223dfc0)
        C:/gopath/src/github.com/ethereum/go-ethereum/eth/downloader/downloader.go:500 +0x58
created by github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).spawnSync
        C:/gopath/src/github.com/ethereum/go-ethereum/eth/downloader/downloader.go:500 +0xce

End of the output when using 2048 cache:

INFO [01-29|17:48:49] Imported new block headers               count=2048 elapsed=577.577ms number=1048576 hash=9a834c…02e52e ignored=0
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0xa4047f]

goroutine 56 [running]:
github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).fetchHeaders(0xc0420509c0, 0xc0421a2e10, 0x108001, 0x0, 0x0)
        C:/gopath/src/github.com/ethereum/go-ethereum/eth/downloader/downloader.go:859 +0xf1f
github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).syncWithPeer.func3(0x8, 0xfbee20)
        C:/gopath/src/github.com/ethereum/go-ethereum/eth/downloader/downloader.go:474 +0x47
github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).spawnSync.func1(0xc068480230, 0xc069d831a0, 0xc0424633e0)
        C:/gopath/src/github.com/ethereum/go-ethereum/eth/downloader/downloader.go:500 +0x58
created by github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).spawnSync
        C:/gopath/src/github.com/ethereum/go-ethereum/eth/downloader/downloader.go:500 +0xce

Crash using 4096 cache:

INFO [01-29|17:57:27] Imported new block headers               count=2048 elapsed=436.157ms number=417024 hash=ab96ba…d0291a ignored=0
INFO [01-29|17:57:29] Imported new block receipts              count=77   elapsed=10.053ms  bytes=65976   number=381208 hash=0a0964…c24196 ignored=0
INFO [01-29|17:57:30] Imported new block receipts              count=2    elapsed=960.5µs   bytes=1027    number=381210 hash=0d539c…8a4e10 ignored=0
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0xa4047f]

goroutine 15 [running]:
github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).fetchHeaders(0xc0422024e0, 0xc042030e10, 0x6c001, 0x0, 0x0)
        C:/gopath/src/github.com/ethereum/go-ethereum/eth/downloader/downloader.go:859 +0xf1f
github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).syncWithPeer.func3(0x8, 0xfbee20)
        C:/gopath/src/github.com/ethereum/go-ethereum/eth/downloader/downloader.go:474 +0x47
github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).spawnSync.func1(0xc0887db4f0, 0xc08b271860, 0xc042211500)
        C:/gopath/src/github.com/ethereum/go-ethereum/eth/downloader/downloader.go:500 +0x58
created by github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).spawnSync
        C:/gopath/src/github.com/ethereum/go-ethereum/eth/downloader/downloader.go:500 +0xce

@holiman
Copy link
Contributor

holiman commented Jan 29, 2018

Ran into the same, maybe. Not mem-related, it's that the dropPeerFn is not set (nil) in the copydb initialization. I'll take a look tomorrow if it's the same, it's trivial to fix if so

@holiman
Copy link
Contributor

holiman commented Jan 30, 2018

Yup, line 859:

	d.dropPeer(p.id)

However, dropPeer is set to nil here: https://github.com/ethereum/go-ethereum/blob/master/cmd/geth/chaincmd.go#L300

@holiman holiman self-assigned this Jan 30, 2018
holiman added a commit to holiman/go-ethereum that referenced this issue Feb 2, 2018
prestonvanloon pushed a commit to prestonvanloon/go-ethereum that referenced this issue Apr 2, 2018
mariameda pushed a commit to NiluPlatform/go-nilu that referenced this issue Aug 23, 2018
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

3 participants