It looks like setting maxreconnections to -1 helped in case of 2 nodes down in 3-nodes cluster.
I don’t receive anymore CatchUpError System.ObjectDisposedException.
Problem still occures when whole cluster is turned off. Client attempts 10 times reconnect and then it receives:
CloseConnection, reason Failed to resolve TCP end point to which to connect., exception System.AggregateException: One or more errors occurred. —> EventStore.ClientAPI.Exceptions.ClusterException: Failed to discover candidate in 10 attempts.
at EventStore.ClientAPI.Internal.ClusterDnsEndPointDiscoverer.<>c__DisplayClass10_0.b__0()
at System.Threading.Tasks.Task1.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- End of inner exception stack trace --- ---> (Inner Exception #0) EventStore.ClientAPI.Exceptions.ClusterException: Failed to discover candidate in 10 attempts. at EventStore.ClientAPI.Internal.ClusterDnsEndPointDiscoverer.<>c__DisplayClass10_0.<DiscoverAsync>b__0() at System.Threading.Tasks.Task
1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()<—
Next getting:
EventStore.ClientAPI.Exceptions.ConnectionClosedException: Connection ‘ES-91b69d3e-4301-4353-93f0-31c9771cc4a4’ was closed
EventStoreConnection ‘ES-91b69d3e-4301-4353-93f0-31c9771cc4a4’: CloseTcpConnection.
EventStoreConnection ‘ES-91b69d3e-4301-4353-93f0-31c9771cc4a4’: IGNORED
(_state: Closed, _conn.ID: {4e39a407-ac9d-4418-8fd8-3ff77646e701}, conn.ID: {4e39a407-ac9d-4418-8fd8-3ff77646e701}): TCP connection to [127.0.0.1:1112, L127.0.0.1:4493] closed.
Catch-up Subscription to test_stream_636566976673691773: requesting stop.
EventStoreConnection ‘ES-91b69d3e-4301-4353-93f0-31c9771cc4a4’: Closed. Reason: Failed to resolve TCP end point to which to connect.
Catch-up Subscription to {0}: unhooking from connection.Connected.
but after that when client try to establish new subscription then each time getting:
Catch-up Subscription to test_stream_636566976673691773: starting
Catch-up Subscription to test_stream_636566976673691773: running.
Catch-up Subscription to test_stream_636566976673691773: pulling events.
Catch-up Subscription to test_stream_636566976673691773: dropping subscription, reason: CatchUpError System.ObjectDisposedException: Cannot access a disposed object.
Object name: ‘ES-91b69d3e-4301-4353-93f0-31c9771cc4a4’.
How I should proper handle ClusterException ? Should I drop old ES connection object and create new one ? Is it ClusterException critical exception that should in result cause client app being turn off ?