-
Notifications
You must be signed in to change notification settings - Fork 926
JsPoolExhaustedException #251
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
Comments
Are you logging exceptions that occur in the site? Can you see if there's any exceptions relating to the JavaScript engine? |
The exception don't seem meaningful to me. JsPoolExhaustedException only occurs after days of running
|
Looking throw React.NET code, I've found a "bad idea" so far In ReactEnvironment class, I'm using my own implementation for keeping Singleton, which is way simpler than Lazy's implementation as it does not need to capture the exception and rethrow
|
Found an issue JavaScriptEngineFactory is registered as singleton. JavaScriptEngineFactory has JsPool. Thus, JsPool is singleton. JsPool has Switching to ConcurrentDictionary should solve the issue. Additionally, this._engineCount should be replaced by _metadata.Count in order to get a consistent count to prevent race condition. Race condition: consider where engine is released and requested from different thread, one thread releases, the other request, but fails at |
Thanks for the information! I switched
I considered this, but creation of a single extra JavaScript engine wasn't too much of a concern. |
Thanks for pushing a fix, just ran into this bug on production. 👍 |
Edit: Unfortunately, about 6 hours after deploying the fix, we ran into the same exception being thrown ( |
You can turn off pooling ( You can increase the maximum engine count using |
After load testing for about an hour on my local machine, I was able to repro the issue. Running an independent load test on JSPool alone using the test suite did not trigger this bug, so I suspicious of this TinyIoC logic that's responsible for returning the current JS engine to the pool after a web request completes. I don't see any evidence of memory corruption in _availableEngines or _metadata. Still investigating. I'm using MVC 5. These screenshots are from |
Hmm, interesting. Thanks for looking into it! I wonder if there's cases where
The other thing you could try is adding an EndRequest event handler in Did you see any exceptions? I wonder if some sort of exception would cause the disposal to fail. |
Ok, I found the problem. Potentially expensive work is being performed in child actions in my project. A JS engine is acquired from the pool when the first It would be awesome if there was a way for What do you think? |
Hmm, it might be possible, although currently ReactJS.NET assumes that the |
I'm running into this problem again... |
Investigating the issue again. According to http://weblog.west-wind.com/posts/2004/Jun/15/ResponseEnd-bites-back-at-HttpApplication-events, EndRequest won't get called if I do Server.Transfer. In my code, there is HttpContext.Current.Server.TransferRequest. However, I couldn't find any leaks after the call as JsPool.AvailableEngineCount stays at 25. My ReactConfig is
Any idea where else I should look? |
I'm running into JsPoolExhaustedException after running React.NET continuously for 5 days. I suspect the JavaScript engine is not being returned into the pool. How can I find where the leak is?
The text was updated successfully, but these errors were encountered: