High CPU Loop with parallel Etc.group iterrations
-------------------------------------------------
Key: JRUBY-6056
URL: https://jira.codehaus.org/browse/JRUBY-6056
Project: JRuby
Issue Type: Bug
Components: Standard Library
Affects Versions: JRuby 1.7
Environment: Mac OSX 10.6.8, JDK 7
Reporter: Chris White
Assignee: Thomas E Enebo
Fix For: JRuby 1.7
Attachments: parallel_group_error.rb
While browsing through the MRI source, I noticed the following code regarding
Etc.group iteration:
{code:title=etc.c|borderStyle=solid}
static void
each_group(void)
{
if (group_blocking) {
rb_raise(rb_eRuntimeError, "parallel group iteration");
}
group_blocking = (int)Qtrue;
rb_ensure(group_iterate, 0, group_ensure, 0);
}
{code}
After running the attached test case, JRuby trunk goes into a high CPU loop.
The C version prevents this by throwing a RuntimeError if you attempt a
parallel loop. In essence the logic is:
# Check a group_blocking flag, and if it exists then throw a runtime error
# If it doesn't exist, set the flag to true
# Continue with the iteration
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email