ethereum / go-ethereum

Go implementation of the Ethereum protocol
https://geth.ethereum.org
GNU Lesser General Public License v3.0
47.37k stars 20.05k forks source link

Swarm segmentation fault in network protocol on deplyoing chequebook #3566

Closed 5chdn closed 6 years ago

5chdn commented 7 years ago

System information

Geth version: geth 1.5.6-stable, swarm 0.2 OS & Version: ArchLinux, w/ kernel 4.8.13-1 Commit hash : n/a

Expected behaviour

Actual behaviour

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

https://testnet.etherscan.io/tx/0x7f940e418b2b0bb9f4de98e82e8aa968cf4ea9a0634f0c24ee9779f08a778ca4

Steps to reproduce the behaviour

    0 ✓ user@ursae ~ $ swarm --swap --datadir ~/.ethereum/testnet/ --ethapi ~/.ethereum/testnet/geth.ipc --keystore ~/.ethereum/testnet/keystore/ --bzzaccount dcf407eae88d480e280db2d0deaa3a11c82eaa9b
    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5339d7]

https://testnet.etherscan.io/tx/0xdd9ce99a0d7034e2646c875304e1bb6ecd3948c8c048515bb8318eec002a8829

Backtrace

    0 ✓ user@ursae ~ $ swarm --swap --datadir ~/.ethereum/testnet/ --ethapi ~/.ethereum/testnet/geth.ipc --keystore ~/.ethereum/testnet/keystore/ --bzzaccount dcf407eae88d480e280db2d0deaa3a11c82eaa9b
    Unlocking swarm account 0xdcf407eae88d480e280db2d0deaa3a11c82eaa9b [1/3]
    Passphrase: 
    I0114 20:22:28.197086 node/node.go:176] instance: swarm/v1.5.6-stable/linux/go1.7.4
    I0114 20:22:28.203641 p2p/server.go:340] Starting Server
    I0114 20:22:30.395153 p2p/discover/udp.go:227] Listening, enode://96cb7d48942d9c81ca59e4d23f0b805ff9d55852d4515773d53dfa907bb215028da8f520334a78301b12145ec3395627d7df7f3ca62ee1f951903e0bcf658d18@[::]:30399
    I0114 20:22:30.395395 p2p/server.go:608] Listening on [::]:30399
    I0114 20:22:30.396446 swarm/services/swap/swap.go:220] Deploying new chequebook (owner: 0xdcf407eae88d480e280db2d0deaa3a11c82eaa9b)
    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5339d7]

    goroutine 417 [running]:
    panic(0xb05f00, 0xc420012120)
      /usr/lib/go/src/runtime/panic.go:500 +0x1a1
    github.com/ethereum/go-ethereum/swarm/network.(*bzz).selfAddr(0xc4204139e0, 0xba9040)
      /build/geth/src/go-ethereum-1.5.6/build/_workspace/src/github.com/ethereum/go-ethereum/swarm/network/protocol.go:468 +0x77
    github.com/ethereum/go-ethereum/swarm/network.(*bzz).handleStatus(0xc4204139e0, 0xc43077a9e0, 0xc85720)
      /build/geth/src/go-ethereum-1.5.6/build/_workspace/src/github.com/ethereum/go-ethereum/swarm/network/protocol.go:346 +0x43
    github.com/ethereum/go-ethereum/swarm/network.run(0xc42025e480, 0x121f220, 0xc420204f60, 0x1222660, 0xc420090050, 0xc4201aa000, 0xc420274ac0, 0xc420274060, 0xc4202d2000, 0x3, ...)
      /build/geth/src/go-ethereum-1.5.6/build/_workspace/src/github.com/ethereum/go-ethereum/swarm/network/protocol.go:185 +0x24c
    github.com/ethereum/go-ethereum/swarm/network.Bzz.func1(0xc4307aa0c0, 0x12193e0, 0xc43055dd50, 0x0, 0x0)
      /build/geth/src/go-ethereum-1.5.6/build/_workspace/src/github.com/ethereum/go-ethereum/swarm/network/protocol.go:146 +0xa9
    github.com/ethereum/go-ethereum/p2p.(*Peer).startProtocols.func1(0xc43055dd50, 0xc4307aa0c0)
      /build/geth/src/go-ethereum-1.5.6/build/_workspace/src/github.com/ethereum/go-ethereum/p2p/peer.go:303 +0x78
    created by github.com/ethereum/go-ethereum/p2p.(*Peer).startProtocols
      /build/geth/src/go-ethereum-1.5.6/build/_workspace/src/github.com/ethereum/go-ethereum/p2p/peer.go:312 +0x25c
    2 ✗ user@ursae ~ $ swarm version
    Swarm
    Version: 0.2
    Network Id: 0
    Go Version: go1.7.4
    OS: linux
    GOPATH=
    GOROOT=/usr/lib/go
    0 ✓ user@ursae ~ $ geth version
    Geth
    Version: 1.5.6-stable
    Protocol Versions: [63 62]
    Network Id: 1
    Go Version: go1.7.4
    OS: linux
    GOPATH=
    GOROOT=/usr/lib/go
    0 ✓ user@ursae ~ $ uname -a
    Linux ursae 4.8.13-1-ARCH #1 SMP PREEMPT Fri Dec 9 07:24:34 CET 2016 x86_64 GNU/Linux
holisticode commented 7 years ago

I haven't been able to reproduce this:

./geth version
Geth
Version: 1.5.9-unstable
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.7.5
OS: linux
GOPATH=/home/fabio/go
GOROOT=/usr/lib/go
./swarm version
Swarm
Version: 0.2

Started geth like this : $GOPATH/bin/geth --testnet --fast --datadir /home/fabio/dat/ethereum/ and swarm: $GOPATH/bin/swarm --swap --datadir ~/dat/ethereum/testnet/ --ethapi ~/dat/ethereum/testnet/geth.ipc --keystore ~/dat/ethereum/testnet/keystore/ --bzzaccount 6d08cefa802c57ca3b2b478d08d1c0a2577e31e7

results here: https://gist.github.com/holisticode/c748d045bc4db0f56bf38fa276baa56b

I0317 19:09:06.362060 swarm/services/swap/swap.go:220] Deploying new chequebook (owner: 0x6d08cefa802c57ca3b2b478d08d1c0a2577e31e7)

I0317 19:09:16.731055 swarm/services/swap/swap.go:226] new chequebook deployed at 0xd8b98e14437c3a999ae77bf1f6b6b4f0c1e0713d (owner: 0x6d08cefa802c57ca3b2b478d08d1c0a2577e31e7)

Maybe latest releases got this fixed?

JMVoid commented 7 years ago

I got same issue running ubuntu linux 16.04 on Virtual machine. When I try to deploy chequebook on private blockchain. every is working fine before add --swap option

- System information: OS: Linux ubuntu150 4.8.0-52-generic #55~16.04.1-Ubuntu SMP Fri Apr 28 14:36:29 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

swarm@ubuntu150:~/eth$ swarm version Swarm Version: 1.6.2-unstable Network Id: 0 Go Version: go1.8.1 OS: linux GOPATH=/home/swarm/goProject GOROOT=/usr/local/go

swarm@ubuntu150:~/eth$ geth version Geth Version: 1.6.2-unstable Architecture: amd64 Protocol Versions: [63 62] Network Id: 1 Go Version: go1.8.1 Operating System: linux GOPATH=/home/swarm/goProject GOROOT=/usr/local/go

Expected behaviour: running Swarm on private blockchain --swap mode for swap test Swarm should be run flawless

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

Backtrace: swarm@ubuntu150:~/eth$ swarm --bzzaccount $BZZACCOUNT --swap --datadir $SWARMDIR --keystore $SWARMDIR/keystore --ethapi $SWARMDIR/geth.ipc --bzznetworkid 201703 26 Unlocking swarm account 0x300c757170a81e584ff0a3d5fa88d47ddca039ab [1/3] Passphrase: INFO [05-24|17:31:21] Starting peer-to-peer node instance=swarm/v1 .6.2-unstable/linux-amd64/go1.8.1 INFO [05-24|17:31:21] Starting P2P networking INFO [05-24|17:31:23] UDP listener up self=enode://2faa 79718924e8945827666cfcf9823e91214e6824f9c642a27d232742bad72aea9043d397cb6deb453c 993c9545fdb74214b24c6ea68c2ee182875bd84b1cd0@100.64.99.175:30399 INFO [05-24|17:31:23] RLPx listener up self=enode://2faa 79718924e8945827666cfcf9823e91214e6824f9c642a27d232742bad72aea9043d397cb6deb453c 993c9545fdb74214b24c6ea68c2ee182875bd84b1cd0@100.64.99.175:30399 INFO [05-24|17:31:23] Deploying new chequebook (owner: 0x300c757170a81e584ff0a3d 5fa88d47ddca039ab) INFO [05-24|17:31:24] Mapped network port proto=udp extport =30399 intport=30399 interface="UPNP IGDv1-IP1" INFO [05-24|17:31:24] Mapped network port proto=tcp extport =30399 intport=30399 interface="UPNP IGDv1-IP1" panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa97375]

goroutine 616 [running]: github.com/ethereum/go-ethereum/swarm/network.(bzz).selfAddr(0xc42032e900, 0x10 ) /home/swarm/goProject/src/github.com/ethereum/go-ethereum/swarm/network/ protocol.go:436 +0x75 github.com/ethereum/go-ethereum/swarm/network.(bzz).handleStatus(0xc42032e900, 0xc42032e900, 0x16) /home/swarm/goProject/src/github.com/ethereum/go-ethereum/swarm/network/ protocol.go:314 +0x43 github.com/ethereum/go-ethereum/swarm/network.run(0xc420461650, 0x13abca0, 0xc42 0017200, 0x13af4a0, 0xc42019a058, 0xc4201a6000, 0xc4200148a0, 0xc420460040, 0xc4 2009c000, 0x133c656, ...) /home/swarm/goProject/src/github.com/ethereum/go-ethereum/swarm/network/ protocol.go:153 +0x1cf github.com/ethereum/go-ethereum/swarm/network.Bzz.func1(0xc420679d10, 0x13a4e20, 0xc420666cb0, 0xc422a00e793788cb, 0x3a3ae0fe2bc3d0e3) /home/swarm/goProject/src/github.com/ethereum/go-ethereum/swarm/network/ protocol.go:118 +0xa9 github.com/ethereum/go-ethereum/p2p.(Peer).startProtocols.func1(0xc420666cb0, 0 xc420679d10) /home/swarm/goProject/src/github.com/ethereum/go-ethereum/p2p/peer.go:30 1 +0x5d created by github.com/ethereum/go-ethereum/p2p.(Peer).startProtocols /home/swarm/goProject/src/github.com/ethereum/go-ethereum/p2p/peer.go:31 0 +0x24a

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

arokapil commented 6 years ago

i am also facing similar issue

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

looks like its related with the Golang

holisticode commented 6 years ago

@arokapil thanks for adding to this issue. However, your stack trace is too small to be able to validate it is indeed related to the same issue or if it's due to something else. Could you please provide a more extensive stack trace (you may look at the original report above for what we are requesting)? Thanks

arokapil commented 6 years ago

Hey thanks for the response!!

i am getting exception while i try to run config.json ... I am using sammy’s open ethereum pool Detail :: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x778737] this is only happening with Etc pool..

This was fine till the day before yesterday Ethereaum pool is fine.. any idea what is this related to??

complete exceptiopn

2018/06/18 15:32:50 Running with 2 threads 2018/06/18 15:32:50 Backend check reply: PONG 2018/06/18 15:32:50 Starting API on 0.0.0.0:8089 2018/06/18 15:32:50 Set stats collect interval to 5s 2018/06/18 15:32:50 Set purge interval to 10m0s 2018/06/18 15:32:50 Policy state refresh complete 2018/06/18 15:32:50 Set policy stats reset every 1h0m0s 2018/06/18 15:32:50 Set policy state refresh every 1m0s 2018/06/18 15:32:50 Running with 8 policy workers 2018/06/18 15:32:50 Upstream: main => http://127.0.0.1:9550 2018/06/18 15:32:50 Upstream: backup => http://127.0.0.2:9550 2018/06/18 15:32:50 Default upstream: main => http://127.0.0.1:9550 2018/06/18 15:32:50 Stratum listening on 0.0.0.0:8007 2018/06/18 15:32:50 Purged stale stats from backend, 0 shares affected, elapsed time 542.018µs 2018/06/18 15:32:50 Stats collection finished 295.754µs panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x77bb7c] goroutine 18 [running]: github.com/sammy007/open-ethereum-pool/proxy.(ProxyServer).fetchPendingBlock(0xc42014e090, 0x70, 0x44, 0x0, 0x0, 0x0) /mnt/sammy007/open-ethereum-pool/ethereum-classic/build/_workspace/src/github.com/sammy007/open-ethereum-pool/proxy/blocks.go:112 +0x23c github.com/sammy007/open-ethereum-pool/proxy.(ProxyServer).fetchBlockTemplate(0xc42014e090) /mnt/sammy007/open-ethereum-pool/ethereum-classic/build/_workspace/src/github.com/sammy007/open-ethereum-pool/proxy/blocks.go:52 +0xe4 github.com/sammy007/open-ethereum-pool/proxy.NewProxy(0xcda7c0, 0xc4200e6da0, 0x0) /mnt/sammy007/open-ethereum-pool/build/_workspace/src/github.com/sammy007/sammy007/open-ethereum-pool/proxy.go:70 +0x4c4 main.startProxy() /mnt/sammy007/open-ethereum-pool/build/_workspace/src/github.com/sammy007/open-ethereum-pool/main.go:24 +0x39 created by main.main /mnt/sammy007/open-ethereum-pool/build/_workspace/src/github.com/sammy007/open-ethereum-pool/main.go:93 +0x28e

Sent from my iPhone

Regards, Kapil

On 18-Jun-2018, at 8:45 PM, holisticode notifications@github.com wrote:

@arokapil thanks for adding to this issue. However, your stack trace is too small to be able to validate it is indeed related to the same issue or if it's due to something else. Could you please provide a more extensive stack trace (you may look at the original report above for what we are requesting)? Thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

holisticode commented 6 years ago

I am sorry but looking at this stack trace it seems unrelated to this issue. Please open a new ticket to report your problem. Thanks

cobordism commented 6 years ago

Closing this issue because Swap is currently being rewritten from scratch.