Skip to content

svrTransHandler.OnError will be called twice when some error occured in svrTransHandler.OnRead #1267

Description

@kingcanfish

Describe the bug
svrTransHandler.OnError will be called twice when some error occured in svrTransHandler.OnRead
image
the first at

t.OnError(ctx, err, conn)

the second at

ts.onError(ctx, err, conn)

so i can see the same log
image

To Reproduce

package main

import (
	"context"
	"log"

	"github.com/cloudwego/kitex-examples/hello/kitex_gen/api/hello"
	"github.com/cloudwego/kitex/client"
)
//client
func main() {
	client, err := hello.NewClient("hello", client.WithHostPorts("0.0.0.0:8888"))
	if err != nil {
		log.Fatal(err)
	}
	resp, err := client.Echo(context.Background(), nil)
	if err != nil {
		log.Fatal(err)
	}
	log.Println(resp)
}
//server
import (
	"log"

	api "github.com/cloudwego/kitex-examples/hello/kitex_gen/api/hello"
)

func main() {
	svr := api.NewServer(new(HelloImpl))

	err := svr.Run()
	if err != nil {
		log.Println(err.Error())
	}
}

Expected behavior

should be called only once?

Screenshots

If applicable, add screenshots to help explain your problem.

Kitex version:

V0.7.3

Environment:

The output of go env.

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions