Skip to content

Thin (ruby EM based server) #506

Closed
Closed

Description

see this gist.


clock_gettime(CLOCK_REALTIME, {1465583395, 663255600}) = 0
clock_gettime(CLOCK_REALTIME, {1465583395, 663347200}) = 0
clock_gettime(CLOCK_REALTIME, {1465583395, 663443500}) = 0
clock_gettime(CLOCK_REALTIME, {1465583395, 663546800}) = 0
times({tms_utime=1014, tms_stime=1579, tms_cutime=6, tms_cstime=15}) = 50171
clock_gettime(CLOCK_REALTIME, {1465583395, 663875500}) = 0
read(17, 0x7fffe278d430, 16384)         = -1 EAGAIN (Resource temporarily unavailable)
clock_gettime(CLOCK_MONOTONIC_RAW, 0x7fffe2791420) = -1 EINVAL (Invalid argument)
clock_gettime(CLOCK_MONOTONIC_RAW, 0x7fffe27914a0) = -1 EINVAL (Invalid argument)
clock_gettime(CLOCK_MONOTONIC_RAW, 0x7fffe2791450) = -1 EINVAL (Invalid argument)
select(19, [12 14 16 17 18], [17], [], {0, 0}) = 2 (in [16], out [17], left {0, 0})
read(16, "", 16384)                     = 0
writev(17, [{"HTTP/1.1 200 OK\r\nX-Frame-Options"..., 354}, {"<!DOCTYPE html>\n<html>\n<head>\n  "..., 1908}], 2) = 2262
clock_gettime(CLOCK_MONOTONIC_RAW, 0x7fffe2791420) = -1 EINVAL (Invalid argument)
clock_gettime(CLOCK_MONOTONIC_RAW, 0x7fffe2791420) = -1 EINVAL (Invalid argument)
clock_gettime(CLOCK_MONOTONIC_RAW, 0x7fffe2791420) = -1 EINVAL (Invalid argument)
clock_gettime(CLOCK_MONOTONIC_RAW, 0x7fffe2791420) = -1 EINVAL (Invalid argument)
clock_gettime(CLOCK_MONOTONIC_RAW, 0x7fffe2791420) = -1 EINVAL (Invalid argument)
clock_gettime(CLOCK_MONOTONIC_RAW, 0x7fffe2791420) = -1 EINVAL (Invalid argument)
clock_gettime(CLOCK_MONOTONIC_RAW, 0x7fffe2791420) = -1 EINVAL (Invalid argument)
clock_gettime(CLOCK_MONOTONIC_RAW, 0x7fffe2791420) = -1 EINVAL (Invalid argument)
clock_gettime(CLOCK_MONOTONIC_RAW, 0x7fffe2791420) = -1 EINVAL (Invalid argument)

(forever)

Activity

  1. sunilmut commented on Jun 15, 2016

    @sunilmut
    Member

    Thanks for reporting this and the strace (very helpful). CLOCK_MONOTONIC_RAW is currently not implemented in WSL. I have opened a bug to track this, but unfortunately it won't make the cut for Anniversary update. Can you please share precise repro steps?

  2. ddfznt commented on Jun 15, 2016

    @ddfznt
    Author

    Just a new rails application with "thin" gem.

    #(install ruby, rails... )
    
    rails new app
    cd app
    echo "gem 'thin'" >> Gemfile
    bundle install 
    thin start
    
    #=> Booting Thin...
    
  3. thomaskilian commented on Jul 4, 2016

    @thomaskilian

    FWIW: I just installed RoR on Debian and ran into this issue. Right after the first page access Ruby runs into this loop and only eventually calms down (almost never, though).

  4. gergap commented on Aug 31, 2016

    @gergap

    I've created an issue specific to the clock_gettime issue. So this might also help in fixing this problem:
    #1023

  5. sodabrew commented on Dec 27, 2016

    @sodabrew

    Hi, I'm the maintainer of the Ruby EventMachine. It should not be using CLOCK_MONOTONIC_RAW on Windows, and does not need it to be available. I wrote a very cross-platform clock wrapper here:

    https://github.com/eventmachine/eventmachine/blob/master/ext/em.cpp#L440

    Is there something about the BashOnWindows toolkit that is making EM think that CLOCK_MONOTONIC_RAW is defined even though it's not actually available from the system?

    Could you post the gem install --verbose eventmachine output that you get? I expect to see something like this:

    ...
    checking for windows.h... yes
    checking for winsock.h... yes
    checking for main() in -lkernel32... yes
    checking for main() in -lrpcrt4... yes
    checking for main() in -lgdi32... yes
    checking for getaddrinfo()... yes
    checking for clock_gettime()... yes
    checking for CLOCK_MONOTONIC_RAW in time.h... no
    checking for CLOCK_MONOTINIC in time.h... yes
    ...
    

    The important part is that CLOCK_MONOTONIC_RAW is not found in time.h, and so EM won't try to use it. A possible bug is if BashOnWindows defines this constant but it's not available from the system?

  6. onekopaka commented on Dec 27, 2016

    @onekopaka

    Hey Aaron Stone (@sodabrew), thanks for checking out this issue! Not to worry, it's not your fault it's broken, your clock wrapper works great when it's not being lied to.

    It's very important to remember that this repository is actually about the Windows Subsystem for Linux, in which Microsoft has reimplemented the Linux kernel ABI, in much the same way that Illumos has lx-branded zones, so Linux binaries can run on a Windows 10 system with the WSL installed without knowing the secret that this is on Windows.

    As such, the relevant snippet of the output of the extconf.rb stage of installing the eventmachine gem looks like this:

    ...
    checking for epoll_create() in sys/epoll.h... yes
    checking for clock_gettime()... yes
    checking for CLOCK_MONOTONIC_RAW in time.h... yes
    checking for CLOCK_MONOTONIC in time.h... yes
    ...
    

    It is definitely an issue that CLOCK_MONOTONIC_RAW is defined in time.h (considering that it's the same time.h you'd find on a normal install of Ubuntu 16.04), but it is not actually implemented in WSL.

  7. sodabrew commented on Dec 27, 2016

    @sodabrew

    Aha! Yes! You'll need to fix that implementation fib then :)

  8. tara-raj commented on May 22, 2018

    @tara-raj

    Closing this issue as it's stale. Bug us if you can repro.

  9. sodabrew commented on May 22, 2018

    @sodabrew

    Tara Raj (@tara-raj) Did you fix it?

  10. RReverser commented on Dec 12, 2018

    @RReverser

    I went through a chain of issues all of which say they are duplicates of others and eventually ended up here, where the issue is closed as stale, but it's very much still reproducable in modern builds. Can it be reopened please?

  11. therealkenc commented on Dec 12, 2018

    @therealkenc

    Thanks. Reopening.

  12. RReverser commented on Dec 12, 2018

    @RReverser

    Hmm, looking at original issue again, I'm starting to suspect that it's not actually the same although likely related to current. Let me recheck and provide more details here tomorrow.

  13. therealkenc commented on Dec 12, 2018

    @therealkenc

    Right. I just found a comment at the bottom of #77 indicating CLOCK_MONOTONIC_RAW was implemented. I had assumed it wasn't. No word in the release notes and no answer to "did you fix it", in May, either (sigh).

    Related or not, better to spawn a new issue with a disciplined repro.

  14. RReverser commented on Dec 12, 2018

    @RReverser

    Yeah, fair enough. Thanks for chasing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions