sammy007 / open-ethereum-pool

Open Ethereum Mining Pool
GNU General Public License v3.0
1.4k stars 1.12k forks source link

segfault on linux on armv7l architecture #224

Open zwammetje opened 6 years ago

zwammetje commented 6 years ago

System information

Geth version: 1.7.2-stable Git Commit: 1db4ecdc0b9e828ff65777fb466fc7c1d04e0de9 Architecture: arm Protocol Versions: [63 62] Network Id: 1 Go Version: go1.9 Operating System: linux GOPATH= GOROOT=/usr/local/go

Redis version: Redis server v=3.2.6 sha=00000000:0 malloc=jemalloc-3.6.0 bits=32 build=826601c992442478

OS & Version: Linux raspberrypi 4.9.59-v7+ #1047 SMP Sun Oct 29 12:19:23 GMT 2017 armv7l GNU/Linux

Commit branch and hash: (master, 225fc2c)

Expected behaviour

Runs beyond the stated output (see backtrace).

Actual behaviour

Segfaults shortly after starting the software.

Steps to reproduce the behaviour

./open-ethereum-pool config.json

Geth and redis-server are running when I try to start the software. I have tried Golang pre-compiled binary and compiled it myself for armv7:

ALL TESTS PASSED

---
Installed Go for linux/arm in /home/pi/gosrc/go
Installed commands in /home/pi/gosrc/go/bin
*** You need to add /home/pi/gosrc/go/bin to your PATH.

Backtrace

2017/11/11 01:29:29 Starting proxy on 127.0.0.1:8888
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x4 pc=0x130fc]

goroutine 31 [running]:
sync/atomic.loadUint64(0x11a16094, 0x37eff0, 0x1198e780)
        /usr/local/go/src/sync/atomic/64bit_arm.go:10 +0x3c
github.com/sammy007/open-ethereum-pool/proxy.(*ProxyServer).isSick(0x11a16060, 0x1198e780)
        /home/pi/open-ethereum-pool/build/_workspace/src/github.com/sammy007/open-ethereum-pool/proxy/proxy.go:301 +0x24
github.com/sammy007/open-ethereum-pool/proxy.(*ProxyServer).broadcastNewJobs(0x11a16060)
        /home/pi/open-ethereum-pool/build/_workspace/src/github.com/sammy007/open-ethereum-pool/proxy/stratum.go:190 +0x54
created by github.com/sammy007/open-ethereum-pool/proxy.(*ProxyServer).fetchBlockTemplate
        /home/pi/open-ethereum-pool/build/_workspace/src/github.com/sammy007/open-ethereum-pool/proxy/blocks.go:95 +0x56c
sammy007 commented 6 years ago

Easiest way to avoid it is to use amd64 arch.

On both ARM and x86-32, it is the caller's responsibility to arrange for 64-bit alignment of 64-bit words accessed atomically. The first word in a variable or in an allocated struct, array, or slice can be relied upon to be 64-bit aligned.

Not time atm to review all structs. You can try to fix it yourself like this https://github.com/sammy007/monero-stratum/commit/bf0ffb035f13898dfc93d9281f83aa1114212f75

sammy007 commented 6 years ago

I wonder why does one run it on arm 32 bit. It's not a toy to play with.

zwammetje commented 6 years ago

I was trying to make it run on a Pi3 for testing purposes before migrating to a better machine. Unfortunately, it's not ARM64. I will try it out on x86-64. Thanks for the quick response.

manipulator01 commented 6 years ago

@zwammetje it's not a smart idea to run this on raspberry pi.

check out these projects instead: https://www.hackster.io/raspberry-pi/projects