Skip to content
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

Memory fragmentation as a result of using SslStream ? #24921

Closed
ayende opened this issue Feb 5, 2018 · 3 comments
Closed

Memory fragmentation as a result of using SslStream ? #24921

ayende opened this issue Feb 5, 2018 · 3 comments

Comments

@ayende
Copy link
Contributor

ayende commented Feb 5, 2018

I'm tracking high memory usage in a server application over a period of about 12 hours or so.
This is .Net Core 2.0.5 app running on Windows Server 2016.

Interesting parts from the memory dump:

000001bdb64d4b50  1590529   1762729490      Free
Total 34634797 objects
Fragmented blocks larger than 0.5 MB:
            Addr     Size      Followed by
000001be1155bb58    1.7MB 000001be11711418 System.Byte[]
000001be117126e8    1.5MB 000001be1189d5a0 System.Byte[]
000001be118a28a0    1.2MB 000001be119d18f0 System.Byte[]
// total of 118 of these

I started to look at these, and found that we have the following distribution:

118 total fragmenting objects, all of them byte[] with the following distribution:

  • 96 buffers - size 3176 bytes
  • 16 buffers - size 72 bytes
  • 6 buffers - size (80, 88, 168, 8216, 16440, 65536)

I dumped a few of the 3176 buffers, and they look like this:
image

This looks like it is a buffer holding a certificate.
All communication with the application is done of over TLS, which means using SslStream.

00007ffeff694160       86         6880 System.Net.Security.SslStream

The numbers don't match up exactly, but it does look like I have a lot of pinned instances like that.

Runing !gcroot shows just a pinned handle and an async pinned handle.

@karelz
Copy link
Member

karelz commented Feb 7, 2018

Do you use SslStream directly on server side?
During 2.1 we added buffer pooling in SslStream, could you try to run your app on 2.1? (see dogfooding)
If you can repro it with 2.1, we would be interested in more details about your app and/or repro.

@ayende
Copy link
Contributor Author

ayende commented Feb 7, 2018

Yes, we are using this directly. We'll try it on 2.1 and report if there is still an issue.

@karelz
Copy link
Member

karelz commented Apr 3, 2018

No response, closing. Let us know if/when there is more info and we can reopen.

@karelz karelz closed this as completed Apr 3, 2018
@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 2.1.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants