-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ArrayMemoryPool.ArrayMemoryPoolBuffer implementation of ref counting isn't thread safe #25235
Comments
This needs to get into preview2 |
See the discussion here: |
These counts need to be accurate, it's not only about use after free (I missed that discussion), the way pipelines uses them relies on this reference counting to return to the pool. If it stays this way we'll keep our own reference count and ignore the Retain/Release semantics of |
From the usage pattern you are describing, it can also lead to use-after-free bugs. Use-after-free bugs are security bugs - much worse than leaks. |
Agreed 😄. Here's a related bug https://github.com/dotnet/corefx/issues/27544. |
@atsushikan, is this fixed? If yes, please close. |
@davidfowl - Pls confirm that dotnet/corefx#27615 addresses your needs (and that we've decided what the semantics are :)) |
Yep, this is good to close |
We're not using interlocked for some reason here and we should be https://github.com/dotnet/corefx/blob/865f08623bd493fb6d239530e00db29bf6736330/src/System.Memory/src/System/Buffers/ArrayMemoryPool.ArrayMemoryPoolBuffer.cs#L80-L98. This could potentially lead to leaks.
/cc @jkotas @atsushikan @ahsonkhan @pakrym @KrzysztofCwalina
The text was updated successfully, but these errors were encountered: