MindscapeHQ / raygun4net

Raygun provider for .NET
https://raygun.com
MIT License
126 stars 93 forks source link

LockRecursionException on UnhandledExceptionBridge on 9.0.0 #513

Closed theolivenbaum closed 9 months ago

theolivenbaum commented 9 months ago

Just saw this exception when using Raygun4net, seems to be related to this file.

Unhandled Exception, will terminate now!
System.Threading.LockRecursionException: Write lock may not be acquired with read lock held. This pattern is prone to deadlocks. Please ensure that read locks are released before taking a write lock. If an upgrade is necessary, use an upgrade lock in place of the read lock.
   at System.Threading.ReaderWriterLockSlim.TryEnterWriteLockCore(TimeoutTracker timeout)
   at System.Threading.ReaderWriterLockSlim.EnterWriteLock()
   at Mindscape.Raygun4Net.UnhandledExceptionBridge.RemoveDeadHandler(WeakExceptionHandler handler) in C:\buildAgent\work\75116afedfe31196\Mindscape.Raygun4Net.NetCore.Common\UnhandledExceptionBridge.cs:line 72
   at Mindscape.Raygun4Net.UnhandledExceptionBridge.WeakExceptionHandler.Invoke(Exception exception, Boolean isTerminating) in C:\buildAgent\work\75116afedfe31196\Mindscape.Raygun4Net.NetCore.Common\UnhandledExceptionBridge.cs:line 123
   at Mindscape.Raygun4Net.UnhandledExceptionBridge.RaiseUnhandledException(Exception exception, Boolean isTerminating) in C:\buildAgent\work\75116afedfe31196\Mindscape.Raygun4Net.NetCore.Common\UnhandledExceptionBridge.cs:line 40
   at Mindscape.Raygun4Net.UnhandledExceptionBridge.<>c.<.cctor>b__3_1(Object sender, UnobservedTaskExceptionEventArgs args) in C:\buildAgent\work\75116afedfe31196\Mindscape.Raygun4Net.NetCore.Common\UnhandledExceptionBridge.cs:line 27
   at System.Threading.Tasks.TaskExceptionHolder.Finalize()
theolivenbaum commented 9 months ago

Probably introduced by this change.

olane commented 9 months ago

We have seen the same with this release.

phillip-haydon commented 9 months ago

Thanks for raising this, I have unlisted v9.0.0 while we investigate and fix this.

xenolightning commented 9 months ago

Thanks for reporting this.

It looks to be caused by the dispatching to a dead handler, and trying to upgrade the lock.

This will be affecting 9.0.0 and 8.2.1, we've delisted both packages, and will be pushing a fix for it ASAP

xenolightning commented 9 months ago

This has been fixed in #514

And released to nuget under 9.0.1

Again, thanks for raising this, and sorry for nuisance this release caused for you.

theolivenbaum commented 9 months ago

No worries! Thanks for the quick fix!

olane commented 7 months ago

Was the wrong version delisted here? On NuGet I'm seeing 8.2.1 still present but 8.2.0 seems to be gone, but I think it should be the other way around: https://www.nuget.org/packages/Mindscape.Raygun4Net.AspNetCore/8.2.1#versions-body-tab

We just mistakenly upgraded to 8.2.1 and hit this again as a result.

xenolightning commented 7 months ago

You're absolutely right @olane - thanks for the heads up.

I've delisted that package now, feel free to reach out if you run into any other issues when upgrading, cheers.