Skip to content

Memory/EventHandler leak #472

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

Closed
yvesgoeleven opened this issue Apr 21, 2015 · 2 comments
Closed

Memory/EventHandler leak #472

yvesgoeleven opened this issue Apr 21, 2015 · 2 comments

Comments

@yvesgoeleven
Copy link

Hi,

I am seeing a memory leak in aspnet 5, which is most likely due to an eventhandler not being unsubscribed, it is easy to reproduce:

File new project & start from 'ASP.NET 5 Preview Starter web'. Hit F5 to load the site in IISExpress and then start refreshing the home page. You will see the memory increase until it hits an out of memory exception.

I took a little bit of time to analyze a memory dump using windbg, There seem to be far to many objects of these types:

6f9303ec 464152 5569824 System.Threading.Overlapped
6f910870 464157 5569884 System.Threading.Tasks.TaskCompletionSource1[[System.Int32, mscorlib]] 6ecdf970 464150 9283000 System.Net.SafeNativeOverlapped 6f913008 462994 11111856 System.Collections.Generic.List1[[System.ArraySegment1[[System.Byte, mscorlib]], mscorlib]] 6f950d2c 464012 13205596 System.Object[] 6f954a2c 481553 13651086 System.Byte[] 6eac9fe8 464150 14852800 System.EventHandler1[[System.Net.Sockets.SocketAsyncEventArgs, System]]
6f92fe5c 464152 14852864 System.Threading.IOCompletionCallback
6f92f364 464170 14853440 System.Threading.ContextCallback
6ecfe4f0 462992 20373296 System.Net.WSABuffer[]
6f8fd980 464937 20457228 System.Threading.Tasks.Task1[[System.Int32, mscorlib]] 6f9132a0 462996 27817776 System.ArraySegment1[[System.Byte, mscorlib]][]
6f51aab4 467510 29920640 System.Threading.OverlappedData
6f92ecec 928389 33422004 System.Runtime.Remoting.Messaging.LogicalCallContext
6f94ea40 928399 40849556 System.Threading.ExecutionContext
6f9536c8 928523 48283196 System.Collections.Hashtable
6f9537b8 928527 83209584 System.Collections.Hashtable+bucket[]
6ed086bc 464151 120679260 System.Net.Sockets.SocketAsyncEventArgs

My gutfeeling says it is related to the eventhandler<System.Net.Sockets.SocketAsyncEventArgs> not being unsubscribed, most likely related to an async task not completing as the gcroot of these instances point to an 'async pinned handle', but I haven't taken the time to investigate much further.

!gcroot 4bb61678
HandleTable:
04dd607c (async pinned handle)
-> 4a9b002c System.Threading.OverlappedData
-> 410a1618 System.Threading.IOCompletionCallback
-> 410a14a0 System.Net.Sockets.SocketAsyncEventArgs
-> 4bb61678 System.EventHandler`1[[System.Net.Sockets.SocketAsyncEventArgs, System]]

If you can't reproduce it, and would like to have the memory dump, let me know we can figure out a way to get it to you (1GB in size)

@eqbalsajadi
Copy link

Hi yvesgoeleven,

I have exactly same problem do you know how to solve it?

@aspnet-hello
Copy link

This issue is being closed because it has not been updated in 3 months.

We apologize if this causes any inconvenience. We ask that if you are still encountering this issue, please log a new issue with updated information and we will investigate.

ryanbrandenburg pushed a commit that referenced this issue Nov 22, 2018
ryanbrandenburg pushed a commit that referenced this issue Nov 22, 2018
@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants