Skip to content

Crash using Websocket to query Tx #55

@jorgecuesta

Description

@jorgecuesta

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/tendermint@v0.32.11-0.20220420160934-de1729fc7dba/libs/pubsub/subscription.go:42
mainnet  | github.com/tendermint/tendermint/rpc/core.Subscribe.func1()
mainnet  | 	/go/pkg/mod/github.com/pokt-network/tendermint@v0.32.11-0.20220420160934-de1729fc7dba/rpc/core/events.go:51 +0x19f
mainnet  | created by github.com/tendermint/tendermint/rpc/core.Subscribe
mainnet  | 	/go/pkg/mod/github.com/pokt-network/tendermint@v0.32.11-0.20220420160934-de1729fc7dba/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))
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions