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

Process CLOCK_MONOTONIC_RAW_APPROX, CLOCK_UPTIME_RAW, and CLOCK_UPTIME_RAW_APPROX constants are not supported #1480

Closed
deepj opened this issue Nov 23, 2018 · 9 comments
Assignees
Milestone

Comments

@deepj
Copy link

deepj commented Nov 23, 2018

This is specific for macOS and it was introduced in Ruby 2.4. See https://github.com/ruby/ruby/blob/v2_4_0/NEWS

To reproduce (only on macOS, I guess):

Process::CLOCK_MONOTONIC_RAW_APPROX

Error:

NameError: uninitialized constant Process::CLOCK_MONOTONIC_RAW_APPROX
Did you mean?  Process::CLOCK_MONOTONIC_RAW_ID
	from (irb):2:in `const_missing'
	from (irb):2
	from ~/.rubies/truffleruby-1.0.0-rc9/bin/irb:29:in `<main>'
@eregon
Copy link
Member

eregon commented Nov 23, 2018

I'm curious, which library uses this constant?

@deepj
Copy link
Author

deepj commented Nov 23, 2018

No one in my case, I just saw this in Ruby 2.4 NEWS. So I just was curious to try it 😇

@chrisseaton chrisseaton self-assigned this Nov 26, 2018
@chrisseaton
Copy link
Collaborator

For Linux we need to implement

  • CLOCK_REALTIME_COARSE
  • CLOCK_REALTIME_ALARM
  • CLOCK_MONOTONIC_COARSE
  • CLOCK_BOOTTIME
  • CLOCK_BOOTTIME_ALARM

@chrisseaton
Copy link
Collaborator

Fix on the way.

@chrisseaton
Copy link
Collaborator

Sorry this was fixed ages ago, forgot to close it.

@eregon eregon added this to the 1.0.0-rc11 milestone Feb 2, 2019
@nickh-stripe
Copy link

This doesn't seem fixed or fixed still? On latest truffleruby:

Process::CLOCK_BOOTTIME
(irb):4:in `const_missing': uninitialized constant Process::CLOCK_BOOTTIME (NameError)
Did you mean?  Process::CLOCK_REALTIME

@eregon
Copy link
Member

eregon commented May 10, 2022

It was fixed but regressed, unfortunately the test guard was written incorrectly and so missed the regression (I'll fix that).
The regression is 37b70d4.
So the fundamental issue is our CI platform (Oracle Linux 7) doesn't have these clocks, and so we can't reliably expose the clock value since the clock might or not exist depending on the Linux version.

@nickh-stripe Do you need CLOCK_BOOTTIME for something specific? Isn't CLOCK_MONOTONIC enough?

@eregon eregon reopened this May 10, 2022
@eregon eregon self-assigned this May 10, 2022
@eregon eregon modified the milestones: 1.0.0-rc11, 22.2.0 May 10, 2022
@eregon
Copy link
Member

eregon commented May 10, 2022

I've got a fix. The trade-off is it will also define these clocks as Process constants on older Linux, and using them with clock_gettime raises EINVAL.

@nickh-stripe
Copy link

Thanks, just some existing code was using it, I don't know enough about why to say whether it could be substituted, just thought reporting it for a easy fix might be beneficial to all 👍 thanks for the quick turnaround.

Strech pushed a commit to Strech/truffleruby that referenced this issue May 23, 2022
…_ALARM

* Giving a non-existing clock to clock_gettime() raises Errno::EINVAL,
  which seems fairly harmless.
* Fixes oracle#1480
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants