kdcllc / CometD.NetCore

CometD for use with Salesforce Platform Events
MIT License
28 stars 16 forks source link

Occasional ConnectionException because of ObjectDisposedException #35

Open UptrendsMartijnH opened 1 year ago

UptrendsMartijnH commented 1 year ago

I am successfully running an integration with this library, however a few times a day I log a ConnectionException with the following stack trace:

System.ObjectDisposedException: Safe handle has been closed
   at System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
   at System.StubHelpers.StubHelpers.SafeHandleAddRef(SafeHandle pHandle, Boolean& success)
   at Microsoft.Win32.Win32Native.SetEvent(SafeWaitHandle handle)
   at System.Threading.EventWaitHandle.Set()
   at CometD.NetCore.Client.BayeuxClient.UpdateBayeuxClientState(BayeuxClientStateUpdater_createDelegate create, BayeuxClientStateUpdater_postCreateDelegate postCreate) in C:\\projects\\cometd-netcore\\src\\CometD.NetCore\\Client\\BayeuxClient.cs:line 733
   at CometD.NetCore.Client.BayeuxClient.PublishTransportListener.OnMessages(IList`1 messages) in C:\\projects\\cometd-netcore\\src\\CometD.NetCore\\Client\\BayeuxClient.cs:line 767
   at CometD.NetCore.Client.Transport.LongPollingTransport.GetResponseCallback(IAsyncResult asynchronousResult) in C:\\projects\\cometd-netcore\\src\\CometD.NetCore\\Client\\Transport\\LongPollingTransport.cs:line 311

I have been looking through the code and trying to debug this issue but I am unsure what causes this. Has somebody else seen this, or know more about this exception occurring?