bee: http: panic serving 127.0.0.1:58978: runtime error: invalid memory address or nil pointer dereference

Hi there,

was trying to upload a 5.5Mb video file.

My configuration:

raspberry pi 4 Linux ubuntu 5.8.0+ #1 SMP PREEMPT Fri Sep 25 22:26:37 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux

bee version

ubuntu@ubuntu:~/.local$ bee version
0.3.2-9d7d98f

upload console

ubuntu@ubuntu:/mnt/beecachefs/ubuntu/Videos/BlickBassy$ curl -F file=@'BLICK BASSY   NLAL.m4a' http://localhost:8080/files
curl: (52) Empty reply from server

got the above on the upload console and the errors below on the bee console. Checked memory, there doesn’t seem to be a problem with memory.

Memory conf:

ubuntu@ubuntu:~/.local$ free -h
              total        used        free      shared  buff/cache   available
Mem:          1.8Gi       647Mi       308Mi       0.0Ki       892Mi       1.2Gi
Swap:         2.0Gi        62Mi       1.9Gi

bee console

ERRO[2020-10-10T11:30:21Z] http: panic serving 127.0.0.1:58978: runtime error: invalid memory address or nil pointer dereference 
ERRO[2020-10-10T11:30:21Z] goroutine 22502 [running]:                   
ERRO[2020-10-10T11:30:21Z] net/http.(*conn).serve.func1(0x40020d8fa0)   
ERRO[2020-10-10T11:30:21Z] 	net/http/server.go:1801 +0xfc               
ERRO[2020-10-10T11:30:21Z] panic(0xcfc340, 0x1a8bb50)                   
ERRO[2020-10-10T11:30:21Z] 	runtime/panic.go:975 +0x370                 
ERRO[2020-10-10T11:30:21Z] math/big.(*Int).Mul(0x400188c638, 0x0, 0x400188c738, 0x0) 
ERRO[2020-10-10T11:30:21Z] 	math/big/int.go:168 +0xcc                   
ERRO[2020-10-10T11:30:21Z] github.com/btcsuite/btcd/btcec.recoverKeyFromSignature(0x1ac41a0, 0x400188c728, 0x4002616280, 0x20, 0x20, 0x2, 0x40033b1700, 0x1, 0x8, 0x70af14) 
ERRO[2020-10-10T11:30:21Z] 	github.com/btcsuite/btcd@v0.20.1-beta/btcec/signature.go:322 +0x1ac 
ERRO[2020-10-10T11:30:21Z] github.com/btcsuite/btcd/btcec.RecoverCompact(0x1ac41a0, 0x400188c7f8, 0x41, 0x41, 0x4002616280, 0x20, 0x20, 0x0, 0x400188c848, 0xb98d00, ...) 
ERRO[2020-10-10T11:30:21Z] 	github.com/btcsuite/btcd@v0.20.1-beta/btcec/signature.go:413 +0x19c 
ERRO[2020-10-10T11:30:21Z] github.com/ethersphere/bee/pkg/crypto.Recover(0x4003f44c20, 0x41, 0xfe8, 0x4002616240, 0x20, 0x20, 0x20, 0x400230e660, 0x11cfe00) 
ERRO[2020-10-10T11:30:21Z] 	github.com/ethersphere/bee/pkg/crypto/signer.go:61 +0xe0 
ERRO[2020-10-10T11:30:21Z] github.com/ethersphere/bee/pkg/soc.recoverAddress(0x4003f44c20, 0x41, 0xfe8, 0x4002616240, 0x20, 0x20, 0x4002616240, 0x20, 0x20, 0x0, ...) 
ERRO[2020-10-10T11:30:21Z] 	github.com/ethersphere/bee/pkg/soc/soc.go:225 +0x50 
ERRO[2020-10-10T11:30:21Z] github.com/ethersphere/bee/pkg/soc.FromChunk(0x11d6120, 0x4005947580, 0x40025a4940, 0x0, 0x0) 
ERRO[2020-10-10T11:30:21Z] 	github.com/ethersphere/bee/pkg/soc/soc.go:145 +0x1a4 
ERRO[2020-10-10T11:30:21Z] github.com/ethersphere/bee/pkg/soc.(*Validator).Validate(0x1af9ee0, 0x11d6120, 0x4005947580, 0x0) 
ERRO[2020-10-10T11:30:21Z] 	github.com/ethersphere/bee/pkg/soc/validator.go:24 +0x30 
ERRO[2020-10-10T11:30:21Z] github.com/ethersphere/bee/pkg/swarm.(*chunkValidator).Validate(0x40004ee5d0, 0x11d6120, 0x4005947580, 0x40025a4920) 
ERRO[2020-10-10T11:30:21Z] 	github.com/ethersphere/bee/pkg/swarm/swarm.go:180 +0x78 
ERRO[2020-10-10T11:30:21Z] github.com/ethersphere/bee/pkg/netstore.(*store).Put(0x4000aac140, 0x11cc140, 0x4003b4e7b0, 0x2, 0x40035baaf0, 0x1, 0x1, 0x400188cb78, 0x2, 0x2, ...) 
ERRO[2020-10-10T11:30:21Z] 	github.com/ethersphere/bee/pkg/netstore/netstore.go:79 +0x74 
ERRO[2020-10-10T11:30:21Z] github.com/ethersphere/bee/pkg/file/pipeline/store.(*storeWriter).ChainWrite(0x4003aaf840, 0x40033c1b00, 0x0, 0x0) 
ERRO[2020-10-10T11:30:21Z] 	github.com/ethersphere/bee/pkg/file/pipeline/store/store.go:49 +0x21c 
ERRO[2020-10-10T11:30:21Z] github.com/ethersphere/bee/pkg/file/pipeline/bmt.(*bmtWriter).ChainWrite(0x40003d2a20, 0x40033c1b00, 0x1000, 0x4003f44c00) 
ERRO[2020-10-10T11:30:21Z] 	github.com/ethersphere/bee/pkg/file/pipeline/bmt/bmt.go:52 +0x154 
ERRO[2020-10-10T11:30:21Z] github.com/ethersphere/bee/pkg/file/pipeline/feeder.(*chunkFeeder).Write(0x4003aaf900, 0x40012bb000, 0x1000, 0x1000, 0x1000, 0x0, 0x0) 
ERRO[2020-10-10T11:30:21Z] 	github.com/ethersphere/bee/pkg/file/pipeline/feeder/feeder.go:78 +0x294 
ERRO[2020-10-10T11:30:21Z] github.com/ethersphere/bee/pkg/file/pipeline/builder.FeedPipeline(0x11cc140, 0x4003b4e7b0, 0x11b9a40, 0x4003aaf900, 0x11ab700, 0x4005076720, 0x548bbe, 0x4003aaf900, 0x0, 0x0, ...) 
ERRO[2020-10-10T11:30:21Z] 	github.com/ethersphere/bee/pkg/file/pipeline/builder/builder.go:100 +0xc8 
ERRO[2020-10-10T11:30:21Z] github.com/ethersphere/bee/pkg/api.(*server).fileUploadHandler(0x40004ff520, 0x11c3800, 0x4003b4e5a0, 0x4004738900) 
ERRO[2020-10-10T11:30:21Z] 	github.com/ethersphere/bee/pkg/api/file.go:157 +0x550 
ERRO[2020-10-10T11:30:21Z] net/http.HandlerFunc.ServeHTTP(0x4000668490, 0x11c3800, 0x4003b4e5a0, 0x4004738900) 
ERRO[2020-10-10T11:30:21Z] 	net/http/server.go:2042 +0x40               
ERRO[2020-10-10T11:30:21Z] github.com/ethersphere/bee/pkg/api.(*server).newTracingHandler.func1.1(0x11c3800, 0x4003b4e5a0, 0x4004738800) 
ERRO[2020-10-10T11:30:21Z] 	github.com/ethersphere/bee/pkg/api/api.go:189 +0x178 
ERRO[2020-10-10T11:30:21Z] net/http.HandlerFunc.ServeHTTP(0x40004eebd0, 0x11c3800, 0x4003b4e5a0, 0x4004738800) 
ERRO[2020-10-10T11:30:21Z] 	net/http/server.go:2042 +0x40               
ERRO[2020-10-10T11:30:21Z] resenje.org/web.HandleMethods(0x40004eeba0, 0xef47f6, 0x2b, 0xede910, 0x1f, 0x11c3800, 0x4003b4e5a0, 0x4004738800) 
ERRO[2020-10-10T11:30:21Z] 	resenje.org/web@v0.4.3/method.go:20 +0x4d4  
ERRO[2020-10-10T11:30:21Z] github.com/ethersphere/bee/pkg/jsonhttp.MethodHandler.ServeHTTP(0x40004eeba0, 0x11c3800, 0x4003b4e5a0, 0x4004738800) 
ERRO[2020-10-10T11:30:21Z] 	github.com/ethersphere/bee/pkg/jsonhttp/handlers.go:16 +0x74 
ERRO[2020-10-10T11:30:21Z] github.com/gorilla/mux.(*Router).ServeHTTP(0x40007180c0, 0x11c3800, 0x4003b4e5a0, 0x4004738600) 
ERRO[2020-10-10T11:30:21Z] 	github.com/gorilla/mux@v1.7.4/mux.go:210 +0x9c 
ERRO[2020-10-10T11:30:21Z] github.com/ethersphere/bee/pkg/api.(*server).gatewayModeForbidHeadersHandler.func1(0x11c3800, 0x4003b4e5a0, 0x4004738600) 
ERRO[2020-10-10T11:30:21Z] 	github.com/ethersphere/bee/pkg/api/router.go:194 +0x54 
ERRO[2020-10-10T11:30:21Z] net/http.HandlerFunc.ServeHTTP(0x400000c800, 0x11c3800, 0x4003b4e5a0, 0x4004738600) 
ERRO[2020-10-10T11:30:21Z] 	net/http/server.go:2042 +0x40               
ERRO[2020-10-10T11:30:21Z] github.com/ethersphere/bee/pkg/api.(*server).setupRouting.func5.1(0x11c3800, 0x4003b4e5a0, 0x4004738600) 
ERRO[2020-10-10T11:30:21Z] 	github.com/ethersphere/bee/pkg/api/router.go:152 +0xb4 
ERRO[2020-10-10T11:30:21Z] net/http.HandlerFunc.ServeHTTP(0x400000c840, 0x11c3800, 0x4003b4e5a0, 0x4004738600) 
ERRO[2020-10-10T11:30:21Z] 	net/http/server.go:2042 +0x40               
ERRO[2020-10-10T11:30:21Z] github.com/ethersphere/bee/pkg/api.(*server).pageviewMetricsHandler.func1(0x11c3800, 0x4003b4e5a0, 0x4004738600) 
ERRO[2020-10-10T11:30:21Z] 	github.com/ethersphere/bee/pkg/api/metrics.go:52 +0x94 
ERRO[2020-10-10T11:30:21Z] net/http.HandlerFunc.ServeHTTP(0x400000c880, 0x11c3800, 0x4003b4e5a0, 0x4004738600) 
ERRO[2020-10-10T11:30:21Z] 	net/http/server.go:2042 +0x40               
ERRO[2020-10-10T11:30:21Z] github.com/gorilla/handlers.CompressHandlerLevel.func1(0x11c3800, 0x4003b4e5a0, 0x4004738600) 
ERRO[2020-10-10T11:30:21Z] 	github.com/gorilla/handlers@v1.4.2/compress.go:148 +0x140 
ERRO[2020-10-10T11:30:21Z] net/http.HandlerFunc.ServeHTTP(0x400000c8c0, 0x11c3800, 0x4003b4e5a0, 0x4004738600) 
ERRO[2020-10-10T11:30:21Z] 	net/http/server.go:2042 +0x40               
ERRO[2020-10-10T11:30:21Z] github.com/ethersphere/bee/pkg/logging.NewHTTPAccessLogHandler.func1.1(0x11c6d80, 0x4000180380, 0x4004738600) 
ERRO[2020-10-10T11:30:21Z] 	github.com/ethersphere/bee/pkg/logging/http_access.go:24 +0xe0 
ERRO[2020-10-10T11:30:21Z] net/http.HandlerFunc.ServeHTTP(0x40009e6a80, 0x11c6d80, 0x4000180380, 0x4004738600) 
ERRO[2020-10-10T11:30:21Z] 	net/http/server.go:2042 +0x40               
ERRO[2020-10-10T11:30:21Z] net/http.serverHandler.ServeHTTP(0x40008b4380, 0x11c6d80, 0x4000180380, 0x4004738600) 
ERRO[2020-10-10T11:30:21Z] 	net/http/server.go:2843 +0xbc               
ERRO[2020-10-10T11:30:21Z] net/http.(*conn).serve(0x40020d8fa0, 0x11cc080, 0x4003b2b280) 
ERRO[2020-10-10T11:30:21Z] 	net/http/server.go:1925 +0x6f4              
ERRO[2020-10-10T11:30:21Z] created by net/http.(*Server).Serve          
ERRO[2020-10-10T11:30:21Z] 	net/http/server.go:2969 +0x2e8              
WARN[2020-10-10T11:31:19Z] connecting to peer [Overlay: 86654bc7ff190b9e913f6eafdaa35181d9809484ce4daddf91b1a50331241c58, Underlay: /ip4/10.0.215.142/tcp/31003/p2p/16Uiu2HAmFjLgmUNhwsUabUrKEQqSkifBVgAjGjSYRppTTCTJPZG2]: context deadline exceeded 

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 21 (9 by maintainers)

Most upvoted comments

@Baleba thank you for the file, I can confirm that the problem is reproducible on amd64 arch with 9d7d98f.

The core problem is much lower in the stack in dependencies. btcd RecoverCompact ends up with nil absolute values of bigints, which is a panic. We are passing a certain data that triggers it, but never nil values to crypto.Recover. Currently, I see no relation to the arm architecture, but it is an important information.

@Baleba could you provide the exact file size in bytes? Or even better the file itself if it is possible?