Skip to content
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

Processdottimesfix #1507

merged 1 commit into from Feb 26, 2014


None yet
2 participants
Copy link

commented Feb 15, 2014

I have a feeling the real fix here is somewhere in jnr.posix since under C rubies, times(2) isn't returning -1 on overflow, this PR is meant to start discussion of a potential fix.

The bug this addresses is here, specifically the "Bugs" section. "A limitation of the Linux system call conventions on some architectures (notably i386) means that on Linux 2.6 there is a small time window (41 seconds) soon after boot when times() can return -1, falsely indicating that an error occurred. The same problem can occur when the return value wraps passed the maximum value that can be stored in clock_t."

In C Ruby, the return value of times(2) is never checked(though it probably should be).

Also, without this patch, the error thrown is ENOENT, or something equally random since there isn't actually an error occurring and being set in kernel space on this call. So, when the old throw occurred from tms being null, it was throwing whatever the last global error value was set to.

I'll stress again that while this keeps 32 bit stuff from crashing, the error is likely in jnr.posix and that our calling conventions from there do not match how Ruby is calling which is causing this issue to manifest.

I consent to having my contributions licensed under EPL, GPLv2, and LGPLv2.


This comment has been minimized.

Copy link
Owner Author

commented on core/src/main/java/org/jruby/ in 5d6df93 Feb 15, 2014

Whoops, this is line 6505 now, probably need a better way to link this.

headius added a commit that referenced this pull request Feb 26, 2014

@headius headius merged commit 378e659 into jruby:jruby-1_7 Feb 26, 2014

1 check failed

default The Travis CI build could not complete due to an error

@headius headius added this to the JRuby 1.7.12 milestone Feb 26, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.