Hi all,
I've been working on the Unicorn HTTP server mostly in Ruby but the
C/Ragel HTTP parser is descended from the Mongrel one. I've made the
parser compatible with Rubinius 0.13 as of commit
c89ce4fb958d79009feb18cea39b14ddf8b11ff5 in unicorn.git, however the
pure-Ruby parts do not appear to pass tests at the moment.
The Ruby parts of Unicorn are extremely *nix-oriented and uses a lot of
things that only work on *nix-like systems. However, everything we do
is currently known to be working under 1.9.1, 1.8.7 and 1.8.6 (and I'm
committed to continue supporting Unicorn on MRI).
Since I'm already short on time/resources and unfamiliar with Rubinius
internals (or C++), but I thought you guys might be interested in
getting Unicorn to run under Rubinius since all the currently failing
parts are still pure Ruby, just not commonly-used Ruby.
Unicorn does a lot of Unix-only things that are uncommon in most Ruby
code:
* Working with unlinked Files (empty ones are also shared across
parent+child and we do fchmod() on them). We also buffer
large uploads to unlinked File objects. This seems to fail
immediately at startup once the master forks off the worker
since each worker gets a file descriptor it shares with
the master.
* Iterating through ObjectSpace for File objects with the O_APPEND
flag and File#sync=true, and then doing File#reopen on them.
This seems to fail under test/unit/test_util.rb
* Signal handlers, I keep them short and process them later in
the main event loops. test_signals.rb seems to get bogged
down and weird, and test_exec.rb is basically shell script
written in Ruby.
* {TCP,UNIX}Server socket objects may be duplicated as bare Socket
objects in the IO_PURGATORY array. We can inherit non-FD_CLOEXEC
file descriptors from our parent, and first create an intermediate
bare Socket object before finally "casting" it into a TCPServer
or UNIXServer socket object. We keep the original Socket in
IO_PURGATORY to prevent the GC from nuking the underlying
descriptor. Not sure how much of a problem this is...
A good chunk of the so-called "unit" tests are actually messy+ugly
integration tests, and they'll fork off all over the place; even run
curl or dd.
I basically do not trust my own knowledge/use of Ruby, especially
after what 1.9 did with encodings; so some tests use curl/dd to write
data to sockets.
Some parts definitely over-test some things, but the tests still run
pretty quickly because I can run them in parallel with GNU make[1].
If you want, please grab the latest code off
git://git.bogomips.org/unicorn and poke around it yourselves
There's the HACKING document in there and I've tried to ensure the weird
parts lib/unicorn.rb and lib/unicorn/util.rb are well-commented. Please
let me know if you have any questions or need clarification for it, I'll
be glad to answer. Just don't ask me to look at and debug C++ :) I'm
very glad your Capi seems to work well and all the HTTP parser tests
pass.
[1] - I'm not afraid to admit I *like* programming with gmake :>
--
Eric Wong
--
--- !ruby/object:MailingList
name: rubinius-dev
view: http://groups.google.com/group/rubinius-dev?hl=en
post: [email protected]
unsubscribe: [email protected]