Skip to content

Error when querying transactions with page and perPage equal 1 #3080

@gianfelipe93

Description

@gianfelipe93

Tendermint version (use tendermint version or git rev-parse --verify HEAD if installed from source): 0.27

ABCI app (name for built-in, URL for self-written if it's publicly available):

Environment:

  • OS (e.g. from /etc/os-release):
  • Install tools:
  • Others:

What happened: If I try query a non existing transaction like so TxSearch(query, true, 1, 1) an error occours:

E[4016-01-04|13:19:43.226] Panic in RPC HTTP handler                    module=rpc-server err="runtime error: index out of range" stack="goroutine 16 [running]:\nruntime/debug.Stack(0xc000b87110, 0x18621c0, 0x21d3910)\n\t/usr/local/Cellar/go/1.11/libexec/src/runtime/debug/stack.go:24 

I have identified the issue and opened a PR that fixes it.

What you expected to happen: I expect to get as a result an object with no transactions and totalCount=0

Have you tried the latest version: yes

How to reproduce it (as minimally and precisely as possible): Try to query a non existing transaction like so TxSearch(query, true, 1, 1)

Logs (paste a small part showing an error (< 10 lines) or link a pastebin, gist, etc. containing more of the log file):

E[4016-01-04|13:19:43.226] Panic in RPC HTTP handler                    module=rpc-server err="runtime error: index out of range" stack="goroutine 16 [running]:\nruntime/debug.Stack(0xc000b87110, 0x18621c0, 0x21d3910)\n\t/usr/local/Cellar/go/1.11/libexec/src/runtime/debug/stack.go:24 +0xa7\ngithub.com/tendermint/tendermint/rpc/lib/server.RecoverAndLogHandler.func1.1(0xc00000db60, 0x1b70400, 0xc000867b60, 0xbf03ce8fcd7680b0, 0x2669ddc, 0x21e9b40, 0xc00018f800)\n\t/Users/gianfelipe/Go/src/github.com/tendermint/tendermint/rpc/lib/server/http_server.go:133 +0x50c\npanic(0x18621c0, 0x21d3910)\n\t/usr/local/Cellar/go/1.11/libexec/src/runtime/panic.go:513 +0x1b9\ngithub.com/tendermint/tendermint/rpc/core.TxSearch(0xc0004aa900, 0x20, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0)\n\t/Users/gianfelipe/Go/src/github.com/tendermint/tendermint/rpc/core/tx.go:200 +0x660\nreflect.Value.call(0x186d6c0, 0x1abf410, 0x13, 0x196033c, 0x4, 0xc000099020, 0x4, 0x4, 0x4, 0x0, ...)\n\t/usr/local/Cellar/go/1.11/libexec/src/reflect/value.go:447 +0x449\nreflect.Value.Call(0x186d6c0, 0x1abf410, 0x13, 0xc000099020, 0x4, 0x4, 0x4, 0x4, 0x0)\n\t/usr/local/Cellar/go/1.11/libexec/src/reflect/value.go:308 +0xa4\ngithub.com/tendermint/tendermint/rpc/lib/server.makeJSONRPCHandler.func1(0x1b6d440, 0xc00000db60, 0xc00018f800)\n\t/Users/gianfelipe/Go/src/github.com/tendermint/tendermint/rpc/lib/server/handlers.go:145 +0x497\ngithub.com/tendermint/tendermint/rpc/lib/server.handleInvalidJSONRPCPaths.func1(0x1b6d440, 0xc00000db60, 0xc00018f800)\n\t/Users/gianfelipe/Go/src/github.com/tendermint/tendermint/rpc/lib/server/handlers.go:165 +0x7e\nnet/http.HandlerFunc.ServeHTTP(0xc000874ae0, 0x1b6d440, 0xc00000db60, 0xc00018f800)\n\t/usr/local/Cellar/go/1.11/libexec/src/net/http/server.go:1964 +0x44\nnet/http.(*ServeMux).ServeHTTP(0xc0008ca6c0, 0x1b6d440, 0xc00000db60, 0xc00018f800)\n\t/usr/local/Cellar/go/1.11/libexec/src/net/http/server.go:2361 +0x127\ngithub.com/tendermint/tendermint/vendor/github.com/rs/cors.(*Cors).Handler.func1(0x1b6d440, 0xc00000db60, 0xc00018f800)\n\t/Users/gianfelipe/Go/src/github.com/tendermint/tendermint/vendor/github.com/rs/cors/cors.go:207 +0xf2\nnet/http.HandlerFunc.ServeHTTP(0xc000867c60, 0x1b6d440, 0xc00000db60, 0xc00018f800)\n\t/usr/local/Cellar/go/1.11/libexec/src/net/http/server.go:1964 +0x44\ngithub.com/tendermint/tendermint/rpc/lib/server.maxBytesHandler.ServeHTTP(0x1b67200, 0xc000867c60, 0xf4240, 0x1b6d440, 0xc00000db60, 0xc00018f800)\n\t/Users/gianfelipe/Go/src/github.com/tendermint/tendermint/rpc/lib/server/http_server.go:178 +0xcf\ngithub.com/tendermint/tendermint/rpc/lib/server.RecoverAndLogHandler.func1(0x1b6ee40, 0xc000110380, 0xc00018f800)\n\t/Users/gianfelipe/Go/src/github.com/tendermint/tendermint/rpc/lib/server/http_server.go:151 +0x25e\nnet/http.HandlerFunc.ServeHTTP(0xc0000fff50, 0x1b6ee40, 0xc000110380, 0xc00018f800)\n\t/usr/local/Cellar/go/1.11/libexec/src/net/http/server.go:1964 +0x44\nnet/http.serverHandler.ServeHTTP(0xc0007e0b60, 0x1b6ee40, 0xc000110380, 0xc00018f800)\n\t/usr/local/Cellar/go/1.11/libexec/src/net/http/server.go:2741 +0xab\nnet/http.(*conn).serve(0xc0009437c0, 0x1b6fac0, 0xc0000317c0)\n\t/usr/local/Cellar/go/1.11/libexec/src/net/http/server.go:1847 +0x646\ncreated by net/http.(*Server)

Config (you can paste only the changes you've made):

node command runtime flags:

/dump_consensus_state output for consensus bugs

Anything else we need to know:
#3053 - this is the PR I have opened to fix the issue. I am still updating it to conform with the guide line but the code is there with tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C:rpcComponent: JSON RPC, gRPCT:bugType Bug (Confirmed)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions