kitex icon indicating copy to clipboard operation
kitex copied to clipboard

i/o timeout when no request is sent after some time

Open zsh-eng opened this issue 1 year ago • 5 comments

Describe the bug When no request is sent to the RPC server for some time, an "i/o timeout" error will occur.

To Reproduce Steps to reproduce the behavior:

  1. Go to kitex-examples/hello
  2. Change the time in client/main.go to 10 seconds.
	for {
		req := &api.Request{Message: "my request"}
		resp, err := client.Echo(context.Background(), req)
		if err != nil {
			log.Fatal(err)
		}
		log.Println(resp)
		time. Sleep(time.Second * 10) // change to 10 seconds

		addReq := &api.AddRequest{First: 512, Second: 512}
		addResp, err := client.Add(context.Background(), addReq)
		if err != nil {
			log.Fatal(err)
		}
		log.Println(addResp)
		time. Sleep(time.Second * 10) // change to 10 seconds
	}
  1. See error

Expected behavior The Kitex client may not continuously be sending requests to the Kitex server. I noticed that we can set WithReadWriteTimeout option to temporarily solve the issue, but the documentation states

WithReadWriteTimeout sets the read/write timeout on network. IMPORTANT: this option is not stable, and will be changed or removed in the future!!! We don't promise compatibility for this option in future versions!!!

Is there some other way to prevent this particular error from occurring?

Screenshots image

Kitex version: v0.5.2

zsh-eng avatar Jun 06 '23 05:06 zsh-eng