Closed digitalextremist closed 11 years ago
It seems this commit breaks jRuby 1.7.4
... at least the version I have.
Related? jruby/jruby/pull/723 ... or jruby/jruby/pull/683?
if defined?( JRUBY_VERSION ) #de && JRUBY_VERSION <= "1.6.7"
fixed it for now...
Excited about Celluloid::IO support in the future potentially.
Works: sucks to do, but works: https://github.com/penultimatix/reel/commit/93e56d8528f48a84df64dea7802d81cec33b4743
Can you please post a stack trace of the error you're experiencing? JRuby should implement IO.copy_stream for this purpose
Sure thing:
Exception: Should be String or IO
[
"org/jruby/RubyIO.java:4286:in `copy_stream'",
"/usr/local/rvm/gems/jruby-1.7.4/bundler/gems/reel-c209110c65b5/lib/reel/response_writer.rb:47:in `handle_response'",
"org/jruby/RubyProc.java:255:in `call'",
"org/jruby/RubyKernel.java:1932:in `public_send'",
"/usr/local/rvm/gems/jruby-1.7.4/bundler/gems/celluloid-ad503d06e9b0/lib/celluloid/calls.rb:25:in `dispatch'",
"/usr/local/rvm/gems/jruby-1.7.4/bundler/gems/celluloid-ad503d06e9b0/lib/celluloid/calls.rb:67:in `dispatch'",
"/usr/local/rvm/gems/jruby-1.7.4/bundler/gems/celluloid-ad503d06e9b0/lib/celluloid/future.rb:14:in `new'",
"/usr/local/rvm/gems/jruby-1.7.4/bundler/gems/celluloid-ad503d06e9b0/lib/celluloid/thread_handle.rb:13:in `initialize'",
"/usr/local/rvm/gems/jruby-1.7.4/bundler/gems/celluloid-ad503d06e9b0/lib/celluloid/thread_handle.rb:12:in `initialize'",
"org/jruby/RubyProc.java:255:in `call'",
"/usr/local/rvm/gems/jruby-1.7.4/bundler/gems/celluloid-ad503d06e9b0/lib/celluloid/internal_pool.rb:100:in `create'",
"(celluloid):0:in `remote procedure call'",
"/usr/local/rvm/gems/jruby-1.7.4/bundler/gems/celluloid-ad503d06e9b0/lib/celluloid/future.rb:104:in `value'",
"/usr/local/rvm/gems/jruby-1.7.4/bundler/gems/celluloid-ad503d06e9b0/lib/celluloid/future.rb:68:in `value'",
"/usr/local/rvm/gems/jruby-1.7.4/bundler/gems/celluloid-ad503d06e9b0/lib/celluloid.rb:452:in `defer'",
"/usr/local/rvm/gems/jruby-1.7.4/bundler/gems/reel-c209110c65b5/lib/reel/response_writer.rb:47:in `handle_response'",
"/usr/local/rvm/gems/jruby-1.7.4/bundler/gems/reel-c209110c65b5/lib/reel/connection.rb:108:in `respond'",
"/mu/zero/qi/reaf/rondar/response.rb:25:in `process_response'",
"/mu/zero/qi/reaf/rondar/skild.rb:20:in `accomodate'",
"/usr/local/rvm/gems/jruby-1.7.4/bundler/gems/reel-c209110c65b5/lib/reel/connection.rb:74:in `each_request'",
"/mu/zero/qi/reaf/rondar/skild.rb:15:in `accomodate'",
"/usr/local/rvm/gems/jruby-1.7.4/bundler/gems/celluloid-ad503d06e9b0/lib/celluloid/calls.rb:25:in `public_send'",
"/usr/local/rvm/gems/jruby-1.7.4/bundler/gems/celluloid-ad503d06e9b0/lib/celluloid/calls.rb:25:in `dispatch'",
"/usr/local/rvm/gems/jruby-1.7.4/bundler/gems/celluloid-ad503d06e9b0/lib/celluloid/calls.rb:67:in `dispatch'",
"/usr/local/rvm/gems/jruby-1.7.4/bundler/gems/celluloid-ad503d06e9b0/lib/celluloid/actor.rb:322:in `handle_message'",
"/usr/local/rvm/gems/jruby-1.7.4/bundler/gems/celluloid-ad503d06e9b0/lib/celluloid/actor.rb:416:in `task'",
"/usr/local/rvm/gems/jruby-1.7.4/bundler/gems/celluloid-ad503d06e9b0/lib/celluloid/tasks.rb:55:in `initialize'",
"/usr/local/rvm/gems/jruby-1.7.4/bundler/gems/celluloid-ad503d06e9b0/lib/celluloid/tasks.rb:47:in `initialize'",
"/usr/local/rvm/gems/jruby-1.7.4/bundler/gems/celluloid-ad503d06e9b0/lib/celluloid/tasks/task_fiber.rb:13:in `create'"
]
@digitalextremist that's very strange. What's getting passed into IO.copy_stream? Could you do an inspect of both parameters before the IO.copy_stream directive on line 47 of Reel's response_writer.rb?
@tarcieri I have done that more superficially, at the point that my code sends it off to Reel's, and it was a File
object. I will modify my patch to inspect further --
Inspect pre-copy:
body=#<File:/mu/zero/public/favicon.ico>,
socket=#<Celluloid::IO::TCPSocket:0x48fc989c @read_buffer="", @eof=false, @addr=nil, @write_latch=#<Celluloid::IO::Stream::Latch:0x3f874f33 @condition=#<Celluloid::Condition:0x4c60bdda>, @waiters=0, @owner=nil>, @read_latch=#<Celluloid::IO::Stream::Latch:0x63505a62 @condition=#<Celluloid::Condition:0x305e0ade>, @waiters=0, @owner=nil>, @socket=#<TCPSocket:fd 2632>, @sync=true, @write_buffer="">
I literally had a dream last night that you and @halorgium fixed this :)
Would love to fix it. Is it possible JRuby simply isn't converting Celluloid::IO::TCPSocket to the underlying IO class?
How could I test that, or how could I patch that line to convert to the underlying IO class in advance?
Well clearly a spec would be super helpful ;) But if you want to try it out yourself:
https://github.com/celluloid/reel/blob/master/lib/reel/response_writer.rb#L47
Change @socket to @socket.to_io
Perfect, thank you. I will try that now.
Worked: submitting patched branch PR //
You should totally add a test! :D
Tony Arcieri
On Sep 11, 2013, at 6:45 PM, digitalextremist notifications@github.com wrote:
Worked: submitting patched branch PR //
— Reply to this email directly or view it on GitHubhttps://github.com/celluloid/reel/issues/87#issuecomment-24289704 .
That'd/ll be the first test written in my life and might lead to good behavior. I will learn this ninja skill called 'add test' -- one moment please!
Ok I don't want to be a pain, but could someone write the test for me and I will use this as an example for my future success in obvious and ordinary practices?
If not, this would be in connection_spec.rb
correct?
I'll write a spec, it's okay. It should probably go in response_writer_spec.rb
Thank you. I look forward to using that as a guide for future specs. Always known this day would come //
Spec added in 8c66e4a7631921dd6d41c7ec6ce5c9dbdd8cccb8
Hmm, the specs passed without your patch :| Oh well, I'll call this solved
Well the real world fails without my patch. Not sure why. Damn you, real world! Sit. Stay!
Thanks again for your spec, and for including my PR.
fea39940f1a828dbfaf55e928134a72d235a1291 seems to have broken responses with Files in them, unless there is a new way of passing those.