-
Notifications
You must be signed in to change notification settings - Fork 83
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
Bug in ThreadMonitor that can cause it to wait unnecessarily #55
Comments
// wait, for threadToMonitor to be set in JS evaluator thread
synchronized (monitor) {
if (threadToMonitor == null) {
monitor.wait(maxCPUTime / MILI_TO_NANO);
}
} |
Hi Chris, thanks for finding this! A pull request would be fantastic! |
Updates to the pull request were to get in line with the existing formatting conventions. |
Any issues with merging this request? Happy to answer any comments or update the PR if needed. |
Fix for issue #55: ThreadMonitor waits unnecessarily
Fix included in release 0.1.14. Please close the issue if the fix is okay. Thank you for reporting and fixing it!! |
Thanks for including and sorry for the delay in closing. |
I had noticed in some stress testing that sometimes the call to execute a function would take the maximum CPU limit time. I tracked it down to an issue in ThreadMonitor in the call to wait on the monitor object. It's possible that the threadToMonitor was already set and the monitor notification sent. In that case, the monitor wait goes to the maximum value for the cpu time limit.
The fix is pretty simple. You simply need to check if the threadToMonitor is not null in the synchronized block, but before the wait, and if it's not null, skip the wait. I can submit a pull request with the fix if that will help.
The text was updated successfully, but these errors were encountered: