-
-
Notifications
You must be signed in to change notification settings - Fork 924
File.utime failing with Errno::EINVAL on JRuby 9.1.17.0 #5261
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
@danielford Good investigation, thank you. I'll have a look at your PR. |
Fix parameters to utimes() fallback call (fixes #5261)
Thanks for the fix! I'm not sure we're planning to release a 9.1.18 now that the 9.2 line has become well-established, but we'll fix those milestones when we do release (cc @enebo). |
I just realized this was a PR against master, which is now the 9.2 line. I'll cherry-pick this change over to the jruby-9.1 branch as well. |
Thanks for merging! I will say that if there is still a chance you folks would release 9.1.18.0, we'd appreciate it. We have started working on importing 9.2 into my company's custom build/deploy system but there were enough changes that it wasn't as easy as dropping in a new tarball (as it would be for the 9.1 branch). But of course we will understand either way, we appreciate the work that goes into creating and supporting JRuby! |
Environment
4.4.20-0.1.fm.237.49.326.metal1.x86_64 #1 SMP Wed Sep 21 11:35:01 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Expected Behavior
This should succeed:
Actual Behavior
This used to work in 9.1.15.0, but now that we've upgraded to 9.1.17.0 we are getting the following error:
Investigation
I tried to troubleshoot this a bit, and I believe I know what's happening. I believe this is related to the patch that was added in #5075. I'm pretty sure what's happening is that the call to utimensat(...) here is failing with a
NotImplementedError
as described in #5075, and then it is falling back to callingutimes
in the catch block here. However, that line is passing in the same exactatimespec
andmtimespec
values from the first call and those values are basically a two-element array containing[seconds, nanoseconds]
, bututimes
is expecting[seconds, microseconds]
. Thus, it fails with anErrno::EINVAL: Invalid argument - Invalid argument
whenever the nanoseconds value is >= 1,000,000 (which would be an invalid value for microseconds). I'm guessing whoever tested the patch from #5075 must be running on a platform whereutimes
is more tolerant of invalid microsecond values.To validate this, I ran the above code in a loop 100,000 times and it actually succeeded 134 times (0.134%). You'd expect the nanoseconds value to be < 1,000,000 about 0.1% of the time. I also ran against 9.1.16.0 and got the same exact
NotImplementedError: utimensat unsupported or native support failed to load
error referenced in #5075.It seems like a pretty simple fix to just divide the nanoseconds value by 1,000 inside the catch block before the call to
utimes
. I will follow up later with a pull request to fix, but that will take me some more time to build and test. I wanted to submit the issue now in case anyone else is having the same problem, and to get any feedback on if my investigation and proposed fix makes sense.I should also mention that despite the title, I'm assuming this is still an issue with JRuby 9.2.0.0 since the relevant code hasn't changed (we just haven't had a chance to upgrade to 9.2.0.0 yet)
The text was updated successfully, but these errors were encountered: