Repository navigation
Conversation
|
Think it mostly arises in Kestrel tests; as a shutdown race |
|
I feel like we need to fix kestrel so it doesn't dispose while in use. |
| } | ||
|
|
||
| Pool.Return(this); | ||
| if (Slab.IsActive) |
| #endif | ||
| GC.SuppressFinalize(block); | ||
|
|
||
| var remaining = Interlocked.Decrement(ref _ownedBlocks); |
There was a problem hiding this comment.
I'm concerned about leaking pinned arrays. Are you sure we would always end up unpinning them?
There was a problem hiding this comment.
Not if the block was never returned
|
|
||
| var remaining = Interlocked.Decrement(ref _ownedBlocks); | ||
|
|
||
| if (remaining < 0) |
There was a problem hiding this comment.
This case is double return. To check for actual dispose use _disposedValue. Can we throw only when the block we are turning is being double returned?
There was a problem hiding this comment.
We do with assert. Should we change assert to exception? What's easier to debug?
| #if DEBUG | ||
| if (_ownedBlocks != 0) | ||
| { | ||
| throw new InvalidOperationException("MemoryPoolBlocks still outstanding!"); |
There was a problem hiding this comment.
Add blocks Leasers to exception message.
|
Tests for things that are reliable testable. |
|
@pakrym I'm happy for you to take this on ð |
|
For the record, aspnet/KestrelHttpServer#2503 was caused by a bug in the GC (https://github.com/dotnet/coreclr/issues/17716) rather than managed heap corruption. |
|
Closing this as there are tons of conflicts and we aren't particularly convinced this is required. |
Update StackExchange.Redis to latest (#341)
May cause heap corruption re: #332 (comment)
Currently it Unpins, then a block is returned which throws an ODE exception aspnet/KestrelHttpServer#2486
Probably bad things also happen as the data block would now be using unpinned memory, with a long previously captured pointer... Like heap corruption? aspnet/KestrelHttpServer#2503 https://github.com/dotnet/coreclr/issues/17679
New spin on this; is the change #332 started throwing ODE exceptions, whereas previously it didn't do, so that may have been where the GC crash leading to hangs surfaced in the error handling/unwind?
Resolves aspnet/KestrelHttpServer#2486 (Test timeout: MemoryPoolBlock ObjectDisposedException)
/cc @pakrym @davidfowl @GrabYourPitchforks @mikeharder @jkotas