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 sometimes attempts to call libc gettimeofday on Windows #4565

aschmied opened this issue Apr 19, 2017 · 1 comment
Closed sometimes attempts to call libc gettimeofday on Windows #4565

aschmied opened this issue Apr 19, 2017 · 1 comment


Copy link

@aschmied aschmied commented Apr 19, 2017


> jruby -v
jruby (2.3.1) 2017-03-06 90fc7ab Java HotSpot(TM) 64-Bit Server VM 25.66-b18 on 1.8.0_66-b18 +jit [mswin32-x86_64]

JRUBY_OPTS=-J-Xms512m -J-Xmx1024m -J-XX:+HeapDumpOnOutOfMemoryError -J-XX:HeapDumpPath=C:/Users/AnthonySchmieder/Desktop/tmp/jruby_hprofs/jruby_jvm_heap_dump.hprof -Xnative.verbose=true

RSpec 3.5.0
Windows 10

Expected Behavior returns the time

Actual Behavior

This looks related to #4501. We have an RSpec test for a class that calls Rails.cache.fetch. Sometimes that call attmpts to call the libc gettimeofday method and throws a NotImplementedError. I have not been able to determine the factors that make the call fail.

Here is the call stack:

       gettimeofday unsupported or native support failed to load; see
     # ./.gems/gems/activesupport- `initialize'
     # ./.gems/gems/activesupport- `block in write'
     # ./.gems/gems/activesupport- `block in instrument'
     # ./.gems/gems/activesupport- `instrument'
     # ./.gems/gems/activesupport- `instrument'
     # ./.gems/gems/activesupport- `write'
     # ./.gems/gems/activesupport- `save_block_result_to_cache'
     # ./.gems/gems/activesupport- `fetch'
     # ./app/models/config/option.rb:223:in `index'
     ... more from our application code

The failing line in cache.rb::initialize is:

@created_at =

This fails deterministically (always on the same spec), but does not fail for all calls to Rails.cache.fetch. Also a call to placed immediately before the call to Rails.cache.fetch always works. Also there are no errors loading a POSIX implementation:

Successfully loaded native POSIX impl.

A workaround is to set native.enabled=false in my .jrubyrc.

Copy link

@headius headius commented Apr 19, 2017

I think the best answer for us here, until we have gettimeofday modified to do the "right thing" on Windows, would be to make the Windows version just provide System.currentTimeMillis as the fallback code does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants