0

I'm trying to port GoEthereum client (v1.9 stable) to RISC-V architecture (on Linux) which is running on an FPGA board. I had successfully cross compiled the geth client using the following Go command. Go version is 1.17.2.

env GO111MODULE=on go run build/ci.go install -arch=riscv64 -cc=riscv64-unknown-linux-gnu-gcc

The RISC-V system is built with imacfd support and has GCC 10.3.0, GLibc 2.34, Linux kernel 5.4.160, buildroot 2021.11 versions.

When we run the geth help command, it works sometimes randomly and fails on subsequent tries. We are receiving different errors such as Segmentation faults, Segmentation Violation, Illegal instruction exception. Please see below the screenshots and full error logs.

Sample segmentation violation error


Error 1:

/go-ethereum/bin # ./geth help
NAME:
   geth - the go-ethereum command line interface

   Copyright 2013-2019 The go-ethereum Authors

USAGE:
   geth [options] command [command options] [arguments...]
   
VERSION:
   1.9.25-stable-e7872729
   
COMMANDS:
   account                            Manage accounts
   attach                             Start an interactive JavaScript environment (connect to node)
   console                            Start an interactive JavaScript environment
   copydb                             Create a local chain from a target chaindata folder

fatal error: timer when must be positive

goroutine 4 [running]:
runtime.throw({0xd5a4dd, 0x1b})
    runtime/panic.go:1198 +0x60 fp=0x3fc4049eb8 sp=0x3fc4049e90 pc=0x65398
runtime.modtimer(0x3fc4074000, 0x800003bfe40a8a9d, 0x0, 0xe1c280, {0x0, 0x0}, 0x0)
    runtime/time.go:425 +0x530 fp=0x3fc4049f00 sp=0x3fc4049eb8 pc=0x89d70
runtime.resettimer(...)
    runtime/time.go:539
time.resetTimer(...)
    runtime/time.go:229
runtime.scavengeSleep(0x7fffffffffffffff)
    runtime/mgcscavenge.go:237 +0x98 fp=0x3fc4049f50 sp=0x3fc4049f00 pc=0x4bbf0
runtime.bgscavenge()
    runtime/mgcscavenge.go:366 +0x29c fp=0x3fc4049fd8 sp=0x3fc4049f50 pc=0x4befc
runtime.goexit()
    runtime/asm_riscv64.s:507 +0x4 fp=0x3fc4049fd8 sp=0x3fc4049fd8 pc=0x9d6fc
created by runtime.gcenable
    runtime/mgc.go:182 +0x94

goroutine 1 [runnable]:
reflect.Value.FieldByIndex({0xc52320, 0x1699f68, 0x199}, {0x3fc43c2780, 0x1, 0x1})
    reflect/value.go:1215 +0x14
text/template.(*state).evalField(0x3fc44a30c8, {0xc52320, 0x1699f68, 0x199}, {0xd8d3cc, 0x4}, {0xf73260, 0x3fc44951a0}, {0x3fc40fda30, 0x1, ...}, ...)
    text/template/exec.go:616 +0x3ac
text/template.(*state).evalFieldChain(0x3fc44a30c8, {0xc52320, 0x1699f68, 0x199}, {0xc52320, 0x1699f68, 0x199}, {0xf73260, 0x3fc44951a0}, {0x3fc40fda00, ...}, ...)
    text/template/exec.go:569 +0x19c
text/template.(*state).evalFieldNode(0x3fc44a30c8, {0xc52320, 0x1699f68, 0x199}, 0x3fc44951a0, {0x3fc40fda30, 0x1, 0x1}, {0xc06700, 0x192b6f8, ...})
    text/template/exec.go:533 +0xe0
text/template.(*state).evalCommand(0x3fc44a30c8, {0xc52320, 0x1699f68, 0x199}, 0x3fc4495170, {0xc06700, 0x192b6f8, 0x99})
    text/template/exec.go:461 +0x368
text/template.(*state).evalPipeline(0x3fc44a30c8, {0xc52320, 0x1699f68, 0x199}, 0x3fc4466780)
    text/template/exec.go:435 +0x108
text/template.(*state).walk(0x3fc44a30c8, {0xc52320, 0x1699f68, 0x199}, {0xf73068, 0x3fc44951d0})
    text/template/exec.go:254 +0x210
text/template.(*state).walk(0x3fc44a30c8, {0xc52320, 0x1699f68, 0x199}, {0xf73338, 0x3fc4495140})
    text/template/exec.go:263 +0x404
text/template.(*state).walkRange.func1({0xbad7a0, 0x16e87c8, 0x82}, {0xc52320, 0x1699f68, 0x199})
    text/template/exec.go:350 +0x170
text/template.(*state).walkRange(0x3fc44a30c8, {0xc523c0, 0x3fc44940c0, 0x99}, 0x3fc44adb40)
    text/template/exec.go:359 +0x514
text/template.(*state).walk(0x3fc44a30c8, {0xc523c0, 0x3fc44940c0, 0x99}, {0xf73458, 0x3fc44adb40})
    text/template/exec.go:266 +0x298
text/template.(*state).walk(0x3fc44a30c8, {0xc523c0, 0x3fc44940c0, 0x99}, {0xf73338, 0x3fc4495080})
    text/template/exec.go:263 +0x404
text/template.(*state).walkIfOrWith(0x3fc44a30c8, 0xa, {0xc523c0, 0x3fc44940c0, 0x99}, 0x3fc44666c0, 0x3fc4495080, 0x0)
    text/template/exec.go:293 +0x1f8
text/template.(*state).walk(0x3fc44a30c8, {0xc523c0, 0x3fc44940c0, 0x99}, {0xf732f0, 0x3fc44adb80})
    text/template/exec.go:260 +0x15c
text/template.(*state).walk(0x3fc44a30c8, {0xc523c0, 0x3fc44940c0, 0x99}, {0xf73338, 0x3fc44941e0})
    text/template/exec.go:263 +0x404
text/template.(*Template).execute(0x3fc44ad400, {0xf51340, 0x3fc40bc2c0}, {0xc523c0, 0x3fc44940c0})
    text/template/exec.go:217 +0x2d4
text/template.(*Template).Execute(...)
    text/template/exec.go:200
github.com/ethereum/go-ethereum/cmd/utils.printHelp({0xf51140, 0x3fc400e020}, {0xd8d1a2, 0x2ad}, {0xc523c0, 0x3fc44940c0})
    github.com/ethereum/go-ethereum/cmd/utils/flags.go:91 +0x2c0
main.init.1.func1({0xf51140, 0x3fc400e020}, {0xd8d1a2, 0x2ad}, {0xcd5c60, 0x3fc446e000})
    github.com/ethereum/go-ethereum/cmd/geth/usage.go:286 +0x454
gopkg.in/urfave/cli%2ev1.ShowAppHelp(0x3fc44a8000)
    gopkg.in/urfave/cli.v1@v1.20.0/help.go:139 +0x16c
gopkg.in/urfave/cli%2ev1.glob..func1(0x3fc44a8000)
    gopkg.in/urfave/cli.v1@v1.20.0/help.go:92 +0x7c
gopkg.in/urfave/cli%2ev1.HandleAction({0xbbb0a0, 0xe1b748}, 0x3fc44a8000)
    gopkg.in/urfave/cli.v1@v1.20.0/app.go:490 +0x7c
gopkg.in/urfave/cli%2ev1.Command.Run({{0xd3c585, 0x4}, {0x0, 0x0}, {0x1681e00, 0x1, 0x1}, {0xd76b6b, 0x30}, {0x0, ...}, ...}, ...)
    gopkg.in/urfave/cli.v1@v1.20.0/command.go:210 +0x820
gopkg.in/urfave/cli%2ev1.(*App).Run(0x3fc446e000, {0x3fc4030040, 0x2, 0x2})
    gopkg.in/urfave/cli.v1@v1.20.0/app.go:255 +0x5ec
main.main()
    github.com/ethereum/go-ethereum/cmd/geth/main.go:273 +0x54

goroutine 6 [chan receive]:
github.com/rjeczalik/notify.(*nonrecursiveTree).dispatch(0x3fc408e2a0, 0x3fc408e1e0)
    github.com/rjeczalik/notify@v0.9.1/tree_nonrecursive.go:36 +0xa8
created by github.com/rjeczalik/notify.newNonrecursiveTree
    github.com/rjeczalik/notify@v0.9.1/tree_nonrecursive.go:29 +0x154

goroutine 7 [chan receive]:
github.com/rjeczalik/notify.(*nonrecursiveTree).internal(0x3fc408e2a0, 0x3fc408e240)
    github.com/rjeczalik/notify@v0.9.1/tree_nonrecursive.go:81 +0x40
created by github.com/rjeczalik/notify.newNonrecursiveTree
    github.com/rjeczalik/notify@v0.9.1/tree_nonrecursive.go:30 +0x180

goroutine 10 [chan receive]:
github.com/ethereum/go-ethereum/core.(*txSenderCacher).cache(0x3fc40fcae0)
    github.com/ethereum/go-ethereum/core/tx_cacher.go:63 +0x48
created by github.com/ethereum/go-ethereum/core.newTxSenderCacher
    github.com/ethereum/go-ethereum/core/tx_cacher.go:55 +0xb8

goroutine 16 [runnable]:
github.com/ethereum/go-ethereum/metrics.(*StandardMeter).tick(0x3fc41fd810)
    github.com/ethereum/go-ethereum/metrics/meter.go:273 +0xac
github.com/ethereum/go-ethereum/metrics.(*meterArbiter).tickMeters(0x18f0900)
    github.com/ethereum/go-ethereum/metrics/meter.go:299 +0xc8
github.com/ethereum/go-ethereum/metrics.(*meterArbiter).tick(0x18f0900)
    github.com/ethereum/go-ethereum/metrics/meter.go:291 +0x58
created by github.com/ethereum/go-ethereum/metrics.NewMeterForced
    github.com/ethereum/go-ethereum/metrics/meter.go:71 +0xe4

goroutine 18 [select]:
github.com/ethereum/go-ethereum/consensus/ethash.(*remoteSealer).loop(0x3fc40c02d0)
    github.com/ethereum/go-ethereum/consensus/ethash/sealer.go:278 +0x13c
created by github.com/ethereum/go-ethereum/consensus/ethash.startRemoteSealer
    github.com/ethereum/go-ethereum/consensus/ethash/sealer.go:262 +0x320

goroutine 20 [syscall]:
os/signal.signal_recv()
    runtime/sigqueue.go:169 +0x134
os/signal.loop()
    os/signal/signal_unix.go:24 +0x24
created by os/signal.Notify.func1.1
    os/signal/signal.go:151 +0x38
/go-ethereum/bin # 

Error 2:

/go-ethereum/bin # ./geth help
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x2 addr=0x1fd07a0 pc=0x1fd07a0]

runtime stack:
runtime.throw({0x10d6cc5, 0x2a})
    runtime/panic.go:1198 +0x60
runtime.sigpanic()
    runtime/signal_unix.go:719 +0x29c

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0xd6f862, 0x3fc40a57a0)
    runtime/cgocall.go:156 +0x50 fp=0x3fc40a5770 sp=0x3fc40a5740 pc=0x29880
github.com/ethereum/go-ethereum/crypto/secp256k1._Cfunc_secp256k1_context_create_sign_verify()
    _cgo_gotypes.go:155 +0x44 fp=0x3fc40a5798 sp=0x3fc40a5770 pc=0x1fbeec
github.com/ethereum/go-ethereum/crypto/secp256k1.init.1()
    github.com/ethereum/go-ethereum/crypto/secp256k1/secp256.go:49 +0x24 fp=0x3fc40a57a8 sp=0x3fc40a5798 pc=0x1fc9bc
runtime.doInit(0x1c3e7a0)
    runtime/proc.go:6498 +0x158 fp=0x3fc40a58f8 sp=0x3fc40a57a8 pc=0x77b40
runtime.doInit(0x1c43d60)
    runtime/proc.go:6475 +0x80 fp=0x3fc40a5a48 sp=0x3fc40a58f8 pc=0x77a68
runtime.doInit(0x1c44c60)
    runtime/proc.go:6475 +0x80 fp=0x3fc40a5b98 sp=0x3fc40a5a48 pc=0x77a68
runtime.doInit(0x1c3c8e0)
    runtime/proc.go:6475 +0x80 fp=0x3fc40a5ce8 sp=0x3fc40a5b98 pc=0x77a68
runtime.doInit(0x1c42100)
    runtime/proc.go:6475 +0x80 fp=0x3fc40a5e38 sp=0x3fc40a5ce8 pc=0x77a68
runtime.doInit(0x1c4bc80)
    runtime/proc.go:6475 +0x80 fp=0x3fc40a5f88 sp=0x3fc40a5e38 pc=0x77a68
runtime.main()
    runtime/proc.go:238 +0x214 fp=0x3fc40a5fd8 sp=0x3fc40a5f88 pc=0x68194
runtime.goexit()
    runtime/asm_riscv64.s:507 +0x4 fp=0x3fc40a5fd8 sp=0x3fc40a5fd8 pc=0x9d854

Note: We tried geth v1.8 & v1.10 as well which resulted in the same issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.