kdcllc/CometD.NetCore

LockRecursionException in ThreadSafeList when disconnecting

ianrandell-sh opened this issue · 5 comments

Hi there - first of all thanks for these brilliant libraries.

I'm getting the following exception when disconnecting as part of handling a connection error (a 403:denied_by_security_policy:create_denied in my case since the channel doesn't exist):

System.Threading.LockRecursionException

"Recursive read lock acquisitions not allowed in this mode"

at System.Threading.ReaderWriterLockSlim.TryEnterReadLockCore(TimeoutTracker timeout)
at System.Collections.Generic.ThreadSafeList`1.<GetEnumerator>d__18.MoveNext() in C:\projects\cometd-netcore\src\CometD.NetCore\Internal\ThreadSafeList.cs:line 201
at CometD.NetCore.Common.AbstractClientSession.ExtendSend(IMutableMessage message) in C:\projects\cometd-netcore\src\CometD.NetCore\Common\AbstractClientSession.cs:line 214
at CometD.NetCore.Client.BayeuxClient.BayeuxClientState.Send(ITransportListener listener, IList`1 messages, Int32 clientTimeout) in C:\projects\cometd-netcore\src\CometD.NetCore\Client\BayeuxClient.cs:line 1003
at CometD.NetCore.Client.BayeuxClient.BayeuxClientState.Send(ITransportListener listener, IMutableMessage message, Int32 clientTimeout) in C:\projects\cometd-netcore\src\CometD.NetCore\Client\BayeuxClient.cs:line 987
at CometD.NetCore.Client.BayeuxClient.DisconnectingState.Execute() in C:\projects\cometd-netcore\src\CometD.NetCore\Client\BayeuxClient.cs:line 1245
at CometD.NetCore.Client.BayeuxClient.UpdateBayeuxClientState(BayeuxClientStateUpdater_createDelegate create, BayeuxClientStateUpdater_postCreateDelegate postCreate) in C:\projects\cometd-netcore\src\CometD.NetCore\Client\BayeuxClient.cs:line 727
at CometD.NetCore.Client.BayeuxClient.UpdateBayeuxClientState(BayeuxClientStateUpdater_createDelegate create) in C:\projects\cometd-netcore\src\CometD.NetCore\Client\BayeuxClient.cs:line 690
at CometD.NetCore.Client.BayeuxClient.Disconnect() in C:\projects\cometd-netcore\src\CometD.NetCore\Client\BayeuxClient.cs:line 143

What I'm using:

  • a slightly modified version of ResilientStreamingClient from your CometD.NetCore.Salesforce repo
  • version 2.0.6 of this nuget (v2.0.7 looks like no code changes)
  • .net core 3.1 on Windows 10

My Disconnect() method in my ResilientStreamingClient is unchanged from your repo version.

Any help appreciated. I'll continue troubleshooting

Hello @ianrandell-sh , did you find a fix for the issue above?

Hello @ianrandell-sh , did you find a fix for the issue above?

Hmm.. this was a while ago but from memory I rewrote some of the code myself. Sorry I cant be more specific. I don't remember there being a very simple fix.

Hello @feresg , have you found a fix about this issue?

The problem can be fixed by enabling the READ permission in Salesforce, on the user profile name for which you want to assign permissions.

https://docs.informatica.com/integration-cloud/cloud-application-integration/current-version/salesforce-connector-guide/introduction-to-salesforce-connector/administration-of-salesforce-connector/assigning-object-permissions-to-the-salesforce-user-for-the-cust.html

Thanks @toojannarong that solved the problem for me but I think the behaviour in this scenario is less than ideal, definitely room to improve how it's handled