Logo
My Account |  Site Map | Contact Us  
Welcome Guest Search | Active Topics | Sign In | Register

Memory leak in ThreadRunner Options
DylanT
Posted: Thursday, November 29, 2018 8:13:55 PM
Rank: Member
Groups: Member

Joined: 6/5/2018
Posts: 12
Hey guys, we've been doing some stress testing using an application that implements the headless EO.Browser via a ThreadRunner, running within a windows Service. We were running load tests, and found that the service always crashes after about 500 tests.

We did a lot of digging last few days and one of the things we turned up was a possible memory leak in the ThreadRunner.

I want to let you know about this, so you can improve your product.

We found some other issues in our own code too! We have fixed these, but our crash remains. In the meantime, here's what we discovered.

You will have to bear with me as your code is obfuscated, so it makes it tricky to work out what is what. However, it appears that a class in your software is collecting stack trace information into a Dictionary, but never clearing out this data, so eventually it fills the memory of the computer. It would take a while, but it is still an issue.

Typical string being collected by this dictionary:
"Handle 0x670b62, Thread=25700, Time=30/11/2018 10:53:17 AM, Call Stack:
at EO.Internal.y.b()
at EO.Internal.y.a(UInt32 A_0, UInt32 A_1, String A_2, IntPtr A_3, a4c A_4, d A_5)
at EO.Internal.y..ctor(UInt32 A_0, UInt32 A_1, String A_2, IntPtr A_3, a4c A_4, d A_5)
at EO.WebBrowser.ThreadRunner.b()
at EO.Base.ThreadRunnerBase.i()
at EO.Base.ThreadRunnerBase.b(Boolean A_0)
at EO.Base.ThreadRunnerBase.h()
at EO.Internal.nl.b()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()"


Location of the Dictionary:
In the obfuscated code for EO.Internal, there is a class called "y" that has an array called "o" which contains the constantly growing list of stack traces.

The specific error we are getting in our Application Log on the server where the service is hosted is:
"Failed to stop service. System.InvalidOperationException: An unhandled exception was detected ---> System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Threading.Monitor.Enter(Object obj)
at EO.Internal.a28.b(String A_0, Object[] A_1)
at EO.Internal.y.a(UInt32 A_0, UInt32 A_1, String A_2, IntPtr A_3, a4c A_4, d A_5)
at EO.Internal.y..ctor(UInt32 A_0, UInt32 A_1, String A_2, IntPtr A_3, a4c A_4, d A_5)
at EO.Internal.y..ctor(a4c A_0)
at EO.Base.ThreadRunnerBase.i()
at EO.Base.ThreadRunnerBase.b(Boolean A_0)
at EO.Base.ThreadRunnerBase.h()
at EO.Internal.nl.b()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.Exec..."

Hope that helps. If I can be of any other assistance please let me know.

eo_support
Posted: Friday, November 30, 2018 9:18:34 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 20,821
Thank you very much for letting us know. Which version do you use?
DylanT
Posted: Sunday, December 2, 2018 7:33:16 PM
Rank: Member
Groups: Member

Joined: 6/5/2018
Posts: 12
This is from nuget, version 18.3.46.

We have also reproduced this exception which occurs for us after about 500 browsers are created and destroyed which then seems to be the trigger for the other exception mentioned above:

EO.Internal.jq+e: Child process exited unexpectedly.
at EO.Base.ThreadRunnerBase.f.a(Int32 A_0, Boolean& A_1)
at EO.Base.ThreadRunnerBase.Send(ActionWithResult action, Int32 timeoutInMS, Boolean& done)
at EO.Base.ThreadRunnerBase.Send(ActionWithResult action, Int32 timeoutInMS)
at EO.WebBrowser.ThreadRunner.Send(WebViewCallback callback, WebView webView, Object args)
at EO.WebBrowser.ThreadRunner.a(Int32 A_0, Int32 A_1, Boolean A_2, BrowserOptions A_3)
at EO.WebBrowser.ThreadRunner.CreateWebView(BrowserOptions options)
at OurProject.HeadlessBrowser.GetNewWebViewWithPreloadedJavascript() in

The line of code where the exception is occurring is:
var runner = new ThreadRunner("VoiceBotBrowserThread", _engine);
--> mActiveView = runner.CreateWebView(new EO.WebEngine.BrowserOptions() { LoadImages = _loadImages, AllowJavaScript = _enableJavaScript });
eo_support
Posted: Monday, December 3, 2018 3:01:01 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 20,821
Hi,

Can you send the test application to us? See here for more information on how to send test project to us:

https://www.essentialobjects.com/forum/test_project.aspx

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.