Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash using Websocket to query Tx #55

Open
jorgecuesta opened this issue Jul 19, 2022 · 0 comments
Open

Crash using Websocket to query Tx #55

jorgecuesta opened this issue Jul 19, 2022 · 0 comments

Comments

@jorgecuesta
Copy link

Context:
I'm trying to subscribe to tendermint Websocket to receive new block and transactions avoiding the use of rpc. NewBlock is working fine, but when subscribe to query Tx the pocket node using this tendermint version crash with the following error:

mainnet  | E[2022-07-19|14:33:01.699] Failed to read request                       module=rpc-server protocol=websocket remote=152.0.175.90:40808 err="websocket: close 1006 (abnormal closure): unexpected EOF"
mainnet  | panic: runtime error: invalid memory address or nil pointer dereference
mainnet  | [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x9f93e0]
mainnet  | 
mainnet  | goroutine 9214 [running]:
mainnet  | github.com/tendermint/tendermint/libs/pubsub.(*Subscription).Out(0xc0034a6cd0?)
mainnet  | 	/go/pkg/mod/github.com/pokt-network/[email protected]/libs/pubsub/subscription.go:42
mainnet  | github.com/tendermint/tendermint/rpc/core.Subscribe.func1()
mainnet  | 	/go/pkg/mod/github.com/pokt-network/[email protected]/rpc/core/events.go:51 +0x19f
mainnet  | created by github.com/tendermint/tendermint/rpc/core.Subscribe
mainnet  | 	/go/pkg/mod/github.com/pokt-network/[email protected]/rpc/core/events.go:48 +0x3d4

I'm running Pocket RC-0.8.3 that is using github.com/pokt-network/tendermint v0.32.11-0.20220420160934-de1729fc7dba in their dependencies.

Code to Test:

package main

import (
	"context"
	"fmt"
	rpchttp "github.com/tendermint/tendermint/rpc/client/http"
	"github.com/tendermint/tendermint/types"
	"time"
)

func main() {
	client, err := rpchttp.New("tcp://localhost:26657", "/websocket")
	if err != nil {
		// handle error
	}
	err = client.Start()
	if err != nil {
		// handle error
	}
	defer client.Stop()
	ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
	defer cancel()
	query := "tm.event = 'Tx'"
	txs, err := client.Subscribe(ctx, "test-client", query)
	if err != nil {
		// handle error
	}

	for e := range txs {
		fmt.Println("got ", e.Data.(types.EventDataTx))
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant