Tendermint: tx_search returns Divide by Zero error

Created on 5 Jun 2018  路  4Comments  路  Source: tendermint/tendermint

Is this a BUG REPORT or FEATURE REQUEST? (choose one):

BUG REPORT

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

0.19.7-a017f2fd

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

github.com/confio/weave

Environment:

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

What happened:

I discovered that tx_search broke when updating from 0.17.1 to 0.19.7, and figured I need to update my client to match the new rpc spec. I was getting an error, so to isolate problems, I started with the example from the rpc docs: https://tendermint.github.io/slate/#txsearch

However, even this breaks the indexer:

$ curl "localhost:46657/tx_search?query=\"account.owner='Ivan'\"&prove=true"
{
  "jsonrpc": "2.0",
  "id": "",
  "error": {
    "code": -32603,
    "message": "Internal error",
    "data": "runtime error: integer divide by zero"
  }
}

What you expected to happen:

I expected at the least an empty response, so I could figure out how to update my queries.

How to reproduce it (as minimally and precisely as possible):

See above...

Logs (you can paste a part showing an error or attach the whole file):

When using the --trace flag, I get the following in the tendermint logs:

E[06-05|11:34:37.338] Panic in RPC HTTP handler                    module=rpc-server err="runtime error: integer divide by zero" stack="goroutine 175 [running]:\nruntime/debug.Stack(0xc422b2b438, 0xb90e80, 0x12723b0)\n\t/usr/lib/go-1.10/src/runtime/debug/stack.go:24 +0xa7\ngithub.com/tendermint/tendermint/rpc/lib/server.RecoverAndLogHandler.func1.1(0xc42024fd20, 0xe49b60, 0xc4201ccba0, 0xbebdbb3354273685, 0x36d891d42, 0x128a260, 0xc420268b00)\n\t/home/ethan/go/src/github.com/tendermint/tendermint/rpc/lib/server/http_server.go:120 +0x4c2\npanic(0xb90e80, 0x12723b0)\n\t/usr/lib/go-1.10/src/runtime/panic.go:502 +0x229\ngithub.com/tendermint/tendermint/rpc/core.validatePage(...)\n\t/home/ethan/go/src/github.com/tendermint/tendermint/rpc/core/pipe.go:128\ngithub.com/tendermint/tendermint/rpc/core.TxSearch(0xc4200e7700, 0x14, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)\n\t/home/ethan/go/src/github.com/tendermint/tendermint/rpc/core/tx.go:192 +0x64d\nreflect.Value.call(0xb9a580, 0xddc810, 0x13, 0xc7f9dd, 0x4, 0xc4200cad80, 0x4, 0x4, 0xc4200cadd0, 0xc4200cadc8, ...)\n\t/usr/lib/go-1.10/src/reflect/value.go:447 +0x969\nreflect.Value.Call(0xb9a580, 0xddc810, 0x13, 0xc4200cad80, 0x4, 0x4, 0x0, 0x0, 0x6c2faf)\n\t/usr/lib/go-1.10/src/reflect/value.go:308 +0xa4\ngithub.com/tendermint/tendermint/rpc/lib/server.makeHTTPHandler.func2(0xe462e0, 0xc42024fd20, 0xc420268b00)\n\t/home/ethan/go/src/github.com/tendermint/tendermint/rpc/lib/server/handlers.go:256 +0x1af\nnet/http.HandlerFunc.ServeHTTP(0xc4222fea80, 0xe462e0, 0xc42024fd20, 0xc420268b00)\n\t/usr/lib/go-1.10/src/net/http/server.go:1947 +0x44\nnet/http.(*ServeMux).ServeHTTP(0xc4222fe660, 0xe462e0, 0xc42024fd20, 0xc420268b00)\n\t/usr/lib/go-1.10/src/net/http/server.go:2337 +0x130\ngithub.com/tendermint/tendermint/rpc/lib/server.RecoverAndLogHandler.func1(0xe488a0, 0xc42019a7e0, 0xc420268b00)\n\t/home/ethan/go/src/github.com/tendermint/tendermint/rpc/lib/server/http_server.go:138 +0x3e3\nnet/http.HandlerFunc.ServeHTTP(0xc420e4ce10, 0xe488a0, 0xc42019a7e0, 0xc420268b00)\n\t/usr/lib/go-1.10/src/net/http/server.go:1947 +0x44\nnet/http.serverHandler.ServeHTTP(0xc421aae4e0, 0xe488a0, 0xc42019a7e0, 0xc420268b00)\n\t/usr/lib/go-1.10/src/net/http/server.go:2694 +0xbc\nnet/http.(*conn).serve(0xc4202130e0, 0xe49320, 0xc422764f80)\n\t/usr/lib/go-1.10/src/net/http/server.go:1830 +0x651\ncreated by net/http.(*Server).Serve\n\t/usr/lib/go-1.10/src/net/http/server.go:2795 +0x27b\n"
I[06-05|11:34:37.339] Served RPC HTTP response                     module=rpc-server method=GET url="/tx_search?query=\"account.owner='Ivan'\"&prove=true" status=200 duration=1 remoteAddr=127.0.0.1:42366

Deciphers to:

goroutine 175 [running]:
runtime/debug.Stack(0xc422b2b438, 0xb90e80, 0x12723b0)
    /usr/lib/go-1.10/src/runtime/debug/stack.go:24 +0xa7
github.com/tendermint/tendermint/rpc/lib/server.RecoverAndLogHandler.func1.1(0xc42024fd20, 0xe49b60, 0xc4201ccba0, 0xbebdbb3354273685, 0x36d891d42, 0x128a260, 0xc420268b00)
    /home/ethan/go/src/github.com/tendermint/tendermint/rpc/lib/server/http_server.go:120 +0x4c2
panic(0xb90e80, 0x12723b0)
    /usr/lib/go-1.10/src/runtime/panic.go:502 +0x229
github.com/tendermint/tendermint/rpc/core.validatePage(...)
    /home/ethan/go/src/github.com/tendermint/tendermint/rpc/core/pipe.go:128
github.com/tendermint/tendermint/rpc/core.TxSearch(0xc4200e7700, 0x14, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
    /home/ethan/go/src/github.com/tendermint/tendermint/rpc/core/tx.go:192 +0x64d
reflect.Value.call(0xb9a580, 0xddc810, 0x13, 0xc7f9dd, 0x4, 0xc4200cad80, 0x4, 0x4, 0xc4200cadd0, 0xc4200cadc8, ...)
    /usr/lib/go-1.10/src/reflect/value.go:447 +0x969
reflect.Value.Call(0xb9a580, 0xddc810, 0x13, 0xc4200cad80, 0x4, 0x4, 0x0, 0x0, 0x6c2faf)
    /usr/lib/go-1.10/src/reflect/value.go:308 +0xa4
github.com/tendermint/tendermint/rpc/lib/server.makeHTTPHandler.func2(0xe462e0, 0xc42024fd20, 0xc420268b00)
    /home/ethan/go/src/github.com/tendermint/tendermint/rpc/lib/server/handlers.go:256 +0x1af
net/http.HandlerFunc.ServeHTTP(0xc4222fea80, 0xe462e0, 0xc42024fd20, 0xc420268b00)
    /usr/lib/go-1.10/src/net/http/server.go:1947 +0x44
net/http.(*ServeMux).ServeHTTP(0xc4222fe660, 0xe462e0, 0xc42024fd20, 0xc420268b00)
    /usr/lib/go-1.10/src/net/http/server.go:2337 +0x130
github.com/tendermint/tendermint/rpc/lib/server.RecoverAndLogHandler.func1(0xe488a0, 0xc42019a7e0, 0xc420268b00)
    /home/ethan/go/src/github.com/tendermint/tendermint/rpc/lib/server/http_server.go:138 +0x3e3
net/http.HandlerFunc.ServeHTTP(0xc420e4ce10, 0xe488a0, 0xc42019a7e0, 0xc420268b00)
    /usr/lib/go-1.10/src/net/http/server.go:1947 +0x44
net/http.serverHandler.ServeHTTP(0xc421aae4e0, 0xe488a0, 0xc42019a7e0, 0xc420268b00)
    /usr/lib/go-1.10/src/net/http/server.go:2694 +0xbc
net/http.(*conn).serve(0xc4202130e0, 0xe49320, 0xc422764f80)
    /usr/lib/go-1.10/src/net/http/server.go:1830 +0x651
created by net/http.(*Server).Serve
    /usr/lib/go-1.10/src/net/http/server.go:2795 +0x27b

/dump_consensus_state output for consensus bugs

Anything else do we need to know:

@melekes can you take a look?

Most helpful comment

Thanks for the quick response.
This fix should make it into 0.20.0?
We're updating tendermint and I'm shaking out all broken rpc calls

(btw, subscribe events seems to work better than ever :+1:)

All 4 comments

Okay, figured it out.

curl "localhost:46657/tx_earch?query=\"account.owner='Ivan'\"&per_page=30"
{
  "jsonrpc": "2.0",
  "id": "",
  "result": {
    "txs": [],
    "total_count": 0
  }
}

Although per_page is documented as optional and default 30, it is actually required, with a default of 0 that causes divide by 0

Although per_page is documented as optional and default 30, it is actually required, with a default of 0 that causes divide by 0

omg 馃槬 thanks Frey

Thanks for the quick response.
This fix should make it into 0.20.0?
We're updating tendermint and I'm shaking out all broken rpc calls

(btw, subscribe events seems to work better than ever :+1:)

Fix will be in v0.19.9 !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

melekes picture melekes  路  4Comments

ebuchman picture ebuchman  路  3Comments

ebuchman picture ebuchman  路  3Comments

gchaincl picture gchaincl  路  3Comments

ebuchman picture ebuchman  路  4Comments