Grpc-go: Client not reconnecting via resetTransport on "connection refused" error

Created on 11 Nov 2016  路  4Comments  路  Source: grpc/grpc-go

Go version: 1.7.3
OS: Mac OS X - x86_64

I am trying to test quite a simple client and server. I restart the server and I expect the client to reconnect. However the error is not treated as a temporary error and the transportMonitor exits.

This is the error I see: dial tcp :10001: getsockopt: connection refused

If I uncomment the code that checks whether the error is temporary my client successfully reconnects when the server is started up again. I think I must be missing something, or is this a bug?

Most helpful comment

I feel the checked-in behavior is not friendly for most users. We plan to revert the changes in #974 and introduce a new dial option to allow users to change the default behavior.

All 4 comments

This is cause by #974, to fix #971.
connection refused is not a temporary error.

Can you give some details about your use case? Do you have some specific situation where you want the client to retry on a dead server?

I think that must be what I am missing. I would simply like the client to reconnect automatically after I restart the server on deploying updated code. Is that a reconnection I should be handling in my own code?

A custom dialer always returns temporary error should work as a workaround.
https://github.com/grpc/grpc-go/blob/master/clientconn.go#L204

If you are using balancer, balancer.Notify() can trigger a new connection to the notified addresses.

I feel the checked-in behavior is not friendly for most users. We plan to revert the changes in #974 and introduce a new dial option to allow users to change the default behavior.

Was this page helpful?
0 / 5 - 0 ratings