Skip to content

Conversation

@norio-nomura
Copy link
Contributor

The documentation says:
https://pkg.go.dev/google.golang.org/grpc#BidiStreamingServer

To terminate the stream, return from the handler method and return an error from the status package, or use nil to indicate an OK status code.

  • Changed to calling proxy.HandleConn()/bicopy.Bicopy() as goroutines, then wait GRPCServerRW.closeCh in TunnelServer.Start() for returning from handler before HandleConn()/bicopy.Bicopy() finishes.
  • Added CloseRead() and CloseWrite() to GRPCServerRW. As a result, GRPCServerRW may be expected to pass the test added by CI: test and fix portfwd issue (w3m -dump hangs) #3708 with inetaf/tcpproxy's tcpproxy.DialProxy() or bicopy.Bicopy().

The documentation says:
https://pkg.go.dev/google.golang.org/grpc#BidiStreamingServer
> To terminate the stream, return from the handler method and return an error from the status package, or use nil to indicate an OK status code.

- Changed to calling `proxy.HandleConn()`/`bicopy.Bicopy()` as goroutines, then wait `GRPCServerRW.closeCh` in `TunnelServer.Start()` for returning from handler before `HandleConn()`/`bicopy.Bicopy()` finishes.
- Added `CloseRead()` and `CloseWrite()` to `GRPCServerRW`. As a result, `GRPCServerRW` may be expected to pass the test added by lima-vm#3708 with inetaf/tcpproxy's `tcpproxy.DialProxy()` or `bicopy.Bicopy()`.

Signed-off-by: Norio Nomura <[email protected]>
@norio-nomura norio-nomura force-pushed the fix-closing-grpc-stream-in-guestagent branch from e8887c4 to 34fa305 Compare October 21, 2025 12:20
@norio-nomura
Copy link
Contributor Author

It passed https://github.com/lima-vm/lima/actions/runs/18683599851/job/53270327592?pr=4237#step:9:617

@norio-nomura norio-nomura marked this pull request as ready for review October 21, 2025 12:57
rw.Close()
}()

proxy := tcpproxy.DialProxy{DialContext: func(_ context.Context, _, _ string) (net.Conn, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AkihiroSuda AkihiroSuda added this to the v2.0.0 milestone Oct 21, 2025
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda AkihiroSuda merged commit e72abc8 into lima-vm:master Oct 21, 2025
63 of 64 checks passed
@norio-nomura
Copy link
Contributor Author

Thanks!🙏🏻

@norio-nomura norio-nomura deleted the fix-closing-grpc-stream-in-guestagent branch October 21, 2025 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants