unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* KGIO issues under WSL
@ 2018-08-14  2:05 Sam Saffron
  2018-08-14  3:14 ` Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Sam Saffron @ 2018-08-14  2:05 UTC (permalink / raw)
  To: unicorn-public, Eric Wong

Howdy,

For some crazy reason we really want to run Unicorn on Windows
Subsytem for Linux. We only use Unicorn in production and some of our
devs like using WSL for "crazy reasons TM".

I guess the on-boarding is somewhat easier for Windows users vs
spinning up a proper VM.

WSL overall works fine but is missing some socket options that mean
Kgio is toast and you can not accept sockets.

linking shared-object kgio_ext.so
make[1]: Leaving directory '/home/sam/kgio/tmp/ext/ruby-2.5.1/ext/kgio'
ruby -I lib:tmp/ext/ruby-2.5.1/ext/kgio test/test_autopush.rb
Loaded suite test/test_autopush
Started
E
=====================================================================================================================================================================================================================================================================================
test/test_autopush.rb:32:in `test_autopush_accessors'
     29:     Kgio.autopush = true
     30:     opt = RUBY_PLATFORM =~ /freebsd/ ? TCP_NOPUSH : TCP_CORK
     31:     s = Kgio::TCPSocket.new(@host, @port)
  => 32:     assert_equal 0, s.getsockopt(Socket::IPPROTO_TCP,
opt).unpack('i')[0]
     33:     assert ! s.kgio_autopush?
     34:     s.kgio_autopush = true
     35:     assert s.kgio_autopush?
test/test_autopush.rb:32:in `getsockopt'
Error: test_autopush_accessors(TestAutopush): Errno::ENOPROTOOPT:
Protocol not available - getsockopt(2)
=====================================================================================================================================================================================================================================================================================
F
=====================================================================================================================================================================================================================================================================================
test/test_autopush.rb:97:in `test_autopush_false'
      94:     @rd.kgio_write "HI\n"
      95:     @wr.kgio_read(3, rbuf)
      96:     diff = Time.now - t0
  =>  97:     assert(diff >= 0.190, "nopush broken? diff=#{diff} > 200ms")
      98:     assert_equal "HI\n", rbuf
      99:   end
     100:
Failure: test_autopush_false(TestAutopush):
  nopush broken? diff=5.68e-05 > 200ms.
  <false> is not true.
=====================================================================================================================================================================================================================================================================================
E
=====================================================================================================================================================================================================================================================================================
test/test_autopush.rb:113:in `test_autopush_true'
     110:       assert_equal 1, lines.grep(/TCP_CORK/).size, lines.inspect
     111:       assert_equal 1, @rd.getsockopt(Socket::SOL_TCP,
TCP_CORK).unpack("i")[0]
     112:     else
  => 113:       @rd = @srv.kgio_accept
     114:     end
     115:
     116:     @wr.write "HI\n"
test/test_autopush.rb:113:in `kgio_accept'
Error: test_autopush_true(TestAutopush): Errno::ENOPROTOOPT: Protocol
not available - getsockopt(TCP_CORK/TCP_NOPUSH)
=====================================================================================================================================================================================================================================================================================
E
=====================================================================================================================================================================================================================================================================================
test/test_autopush.rb:64:in `test_autopush_true_unix'
     61:       lines = io.readlines
     62:       assert lines.grep(/TCP_CORK/).empty?, lines.inspect
     63:     else
  => 64:       @wr = @srv.kgio_accept
     65:       t0 = Time.now
     66:       @wr.kgio_write "HI\n"
     67:       rc = @wr.kgio_tryread 666
test/test_autopush.rb:64:in `kgio_accept'
Error: test_autopush_true_unix(TestAutopush): Errno::EINVAL: Invalid
argument - getsockopt(TCP_CORK/TCP_NOPUSH)
=====================================================================================================================================================================================================================================================================================

Finished in 0.0209615 seconds.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4 tests, 7 assertions, 1 failures, 3 errors, 0 pendings, 0 omissions,
0 notifications
0% passed
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
190.83 tests/s, 333.95 assertions/s
pkg.mk:122: recipe for target 'test/test_autopush.rb' failed
make: *** [test/test_autopush.rb] Error 1
sam@sams-pc:~/kgio$


I was thinking since we are going to be giving up kgio longer term
anyway, is there a way of having some flag for running unicorn without
kgio or maybe even with minimal socket options given setsockoptions
and getsockoptions are patchy. A monkey patch would be fine a well
cause this is just for development and Puma seems to be ok-ish.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: KGIO issues under WSL
  2018-08-14  2:05 KGIO issues under WSL Sam Saffron
@ 2018-08-14  3:14 ` Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2018-08-14  3:14 UTC (permalink / raw)
  To: Sam Saffron; +Cc: unicorn-public

Sam Saffron <sam.saffron@gmail.com> wrote:
> Howdy,
> 
> For some crazy reason we really want to run Unicorn on Windows
> Subsytem for Linux. We only use Unicorn in production and some of our
> devs like using WSL for "crazy reasons TM".
> 
> I guess the on-boarding is somewhat easier for Windows users vs
> spinning up a proper VM.

IMHO, you're holding your developers back and they'll constantly
be running into new problems in Ruby development.

> WSL overall works fine but is missing some socket options that mean
> Kgio is toast and you can not accept sockets.

WSL needs to add support for those Linux options if they intend
to pass themselves off as Linux-compatible.  And it seems you
guys pay for MS licenses, so they they should be fixing stuff
for you.

<snip>

> I was thinking since we are going to be giving up kgio longer term
> anyway, is there a way of having some flag for running unicorn without
> kgio or maybe even with minimal socket options given setsockoptions
> and getsockoptions are patchy. A monkey patch would be fine a well
> cause this is just for development and Puma seems to be ok-ish.

No flags or new options for this.  Ruby 2.3+ should be OK to run
entirely w/o kgio using the `exception: false` keyword.  I don't
know if you want to take a stab at it, there's not a whole lot
of kgio use in unicorn, even.

However, Ruby 2.0 and even 1.9.3 support should be maintained;
but maybe that can lazy-load kgio and fall back to expensive
exceptions if kgio isn't found.

There should be no increase in the bytecode or stack footprint
for 2.3+ users, but it's fine for users on older Rubies.

I also wouldn't worry about exception costs for exception paths
where kgio_trywrite tries to write something but gives up if it
doesn't work; but the accept_nonblock codepath is pretty critical
for being kept garbage-free.


Anyways, we will never advertise support for any proprietary
systems, if it works it's incidental.

(Abg gung jr nqiregvfr ng nyy :C)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-14  3:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-14  2:05 KGIO issues under WSL Sam Saffron
2018-08-14  3:14 ` Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).