Subscription closing for no apparent reason

Hello,

I’ve tried both CatchUpSubscriptions and PersistentSubscriptions. Both seem to fail at random points with no details as to why is failed. I enabled verbose logging and this is what I received.

2018-11-15T05:00:57 PID[5536] Information [354,05:00:57.015,DEBUG] EventStoreConnection ‘ES-bbdefe4b-0c6d-49f8-a7f1-f65019fee035’: enqueueing message EventStore.ClientAPI.Internal.HandleTcpPackageMessage…
2018-11-15T05:00:58 PID[5536] Information [354,05:00:58.028,INFO] ClientAPI TcpConnection closed [05:00:58.023: N34.236.146.52:1113, L10.0.5.204:50240, {1e5aa36b-22c6-45bb-b772-2fcd5fa8b6f1}]:
2018-11-15T05:00:58 PID[5536] Information [354,05:00:58.028,INFO] Received bytes: 436142, Sent bytes: 81970
2018-11-15T05:00:58 PID[5536] Information [354,05:00:58.028,INFO] Send calls: 1346, callbacks: 1346
2018-11-15T05:00:58 PID[5536] Information [354,05:00:58.028,INFO] Receive calls: 1339, callbacks: 1339
2018-11-15T05:00:58 PID[5536] Information [354,05:00:58.028,INFO] Close reason: [Success] Socket closed
2018-11-15T05:00:58 PID[5536] Information [354,05:00:58.030,DEBUG] TcpPackageConnection: connection [34.236.146.52:1113, L10.0.5.204:50240, {1e5aa36b-22c6-45bb-b772-2fcd5fa8b6f1}] was closed cleanly.
2018-11-15T05:00:58 PID[5536] Information [354,05:00:58.030,DEBUG] EventStoreConnection ‘ES-bbdefe4b-0c6d-49f8-a7f1-f65019fee035’: enqueueing message EventStore.ClientAPI.Internal.TcpConnectionClosedMessage…
2018-11-15T05:00:58 PID[5536] Information [365,05:00:58.534,DEBUG] EventStoreConnection ‘ES-bbdefe4b-0c6d-49f8-a7f1-f65019fee035’: HandleTcpPackage connId 1e5aa36b-22c6-45bb-b772-2fcd5fa8b6f1, package HeartbeatRequestCommand, f58eb771-dfc6-4af0-889a-db7932ba94c0…
2018-11-15T05:00:58 PID[5536] Information [365,05:00:58.542,DEBUG] EventStoreConnection ‘ES-bbdefe4b-0c6d-49f8-a7f1-f65019fee035’: TCP connection to [34.236.146.52:1113, L10.0.5.204:50240, {1e5aa36b-22c6-45bb-b772-2fcd5fa8b6f1}] closed…
2018-11-15T05:00:58 PID[5536] Information [365,05:00:58.553,DEBUG] Subscription {729202fd-0ddd-4499-b388-30585ea538db} to connection-stream: closing subscription, reason: ConnectionClosed, exception: EventStore.ClientAPI.Exceptions.ConnectionClosedException: Connection was closed…
2018-11-15T05:00:58 PID[5536] Information [365,05:00:58.554,DEBUG] Subscription {35c3a0c2-1e58-4f9f-8c70-dd1a0db763d9} to channel-stream: closing subscription, reason: ConnectionClosed, exception: EventStore.ClientAPI.Exceptions.ConnectionClosedException: Connection was closed…
2018-11-15T05:00:58 PID[5536] Information [365,05:00:58.562,DEBUG] Persistent Subscription to connection-stream: dropping subscription, reason: ConnectionClosed EventStore.ClientAPI.Exceptions.ConnectionClosedException: Connection was closed…
2018-11-15T05:00:58 PID[5536] Information [365,05:00:58.563,DEBUG] Persistent Subscription to connection-stream: requesting stop…
2018-11-15T05:00:58 PID[5536] Information [361,05:00:58.564,DEBUG] EventStoreConnection ‘ES-bbdefe4b-0c6d-49f8-a7f1-f65019fee035’: enqueueing message EventStore.ClientAPI.Internal.StartOperationMessage…
2018-11-15T05:00:58 PID[5536] Information [365,05:00:58.672,DEBUG] Persistent Subscription to channel-stream: dropping subscription, reason: ConnectionClosed EventStore.ClientAPI.Exceptions.ConnectionClosedException: Connection was closed.

``

Can you please give me some insight into what Close reason: [Success] Socket closed means and why it keeps disconnecting?

I also have function on subscriptionDropped that reconnects to the subscription, but after a certain amount of time it just stops reconnecting when using a Persistent Subscription. Any reason why?

private static void SubscribeToPersistentStream(IEventStoreConnection connection,
string stream,
Action<EventStorePersistentSubscriptionBase, ResolvedEvent> eventAppeared)
{
Console.WriteLine($“Connecting to persistent stream: {stream}”);
connection.ConnectToPersistentSubscription(stream, “MyGroup”, eventAppeared,
(sb, sdr, ex) =>
{
// I added this in hopes that it would help but it did nothing.
sb.Stop(TimeSpan.FromMilliseconds(100));

     Console.WriteLine($"Event Store Persistent Subscription Dropped: Stream {stream}, Exception: {ex}, Reason {sdr}");
     SubscribeToPersistentStream(connection, stream, eventAppeared);
 });

}

``

Thanks in advance.