The code consistently produces the said error for me provided I use jruby-0.8.3 (compiled and run with sun-jdk-1.4.2_10), run just like "java -jar jruby.jar -e '<code goes here>'".
I upgraded to the latest cvs and the problem seems to be already fixed, so I guess we'll leave it at that. Evan Ola Bini wrote: > ... and again, at least when running your code in jirb, the call blocks > at read, as expected. I also made a script of this, and run it with > jruby, and it seems to block. which means I cannot reproduce this > behaviour. > > Regards > Ola Bini > > ----- Original Message ----- > From: Evan <[EMAIL PROTECTED]> > Date: Friday, April 7, 2006 10:00 pm > Subject: [Jruby-devel] 0.8.3 Socket implementation broken > To: jruby-devel@lists.sourceforge.net > >> I'm porting my socket+send/recv patch to work with jruby 0.8.3 but >> thereseems to be a bug in the vanilla jruby 0.8.3 socket >> implementation. >> "read" (I haven't tried write...) returns something (instead of >> blocking)which when accessed crashes the interpreter. Since the IO >> code seems to >> have changed minimally, this probably has to do with some IO code >> *not*being updated to reflect changes made elsewhere. >> >> I really am the only one using JRuby sockets, aren't I? Its going >> to be >> impossible to implement the *whole* socket interface, as a lot of >> the Ruby >> socket implementation reflects C's socket implementation. As long >> as I'm >> messing around with sockets, though, I could probably get a bigger >> userbase by implementing whatever it is that rails needs to use the >> native sql >> connector code. Does anyone know what that is? Maybe I'll just look >> through the code. >> >> Anyway, I'm looking into this, but any help would be appreciated. >> >> To reproduce: >> >> require 'socket' >> s = TCPSocket.new('www.google.com', 80) >> >> string = s.read(10) >> >> $stderr.puts "Still haven't crashed" >> >> puts string >> >> This produces: >> >> Still haven't crashed >> org.jruby.RubyIO.puts(RubyIO.java:777): >> java.lang.NullPointerException:null (NativeException) >> from org.jruby.RubyKernel.puts(RubyKernel.java:253) >> from sun.reflect.NativeMethodAccessorImpl.invoke0(Native >> Method) from >> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >> from >> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >> from java.lang.reflect.Method.invoke(Method.java:324) >> from >> > org.jruby.runtime.callback.ReflectionCallback.execute(ReflectionCallback.java:140) >> from >> > org.jruby.internal.runtime.methods.CallbackMethod.internalCall(CallbackMethod.java:79) >> from >> > org.jruby.internal.runtime.methods.AbstractMethod.call(AbstractMethod.java:51) >> ... 25 levels... >> from org.jruby.Main.runInterpreter(Main.java:121) >> from org.jruby.Main.main(Main.java:82) >> from breakme.rb:8 >> Complete Java stackTrace >> java.lang.NullPointerException >> at org.jruby.RubyIO.puts(RubyIO.java:777) >> at org.jruby.RubyKernel.puts(RubyKernel.java:253) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >> at >> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >> at java.lang.reflect.Method.invoke(Method.java:324) >> at >> > org.jruby.runtime.callback.ReflectionCallback.execute(ReflectionCallback.java:140) >> at >> > org.jruby.internal.runtime.methods.CallbackMethod.internalCall(CallbackMethod.java:79) >> at >> > org.jruby.internal.runtime.methods.AbstractMethod.call(AbstractMethod.java:51) >> at org.jruby.RubyObject.callMethod(RubyObject.java:361) >> at org.jruby.RubyObject.callMethod(RubyObject.java:315) >> at >> > org.jruby.evaluator.EvaluateVisitor$FCallNodeVisitor.execute(EvaluateVisitor.java:1028) >> at >> org.jruby.evaluator.EvaluationState.executeNext(EvaluationState.java:211) >> at >> org.jruby.evaluator.EvaluationState.begin(EvaluationState.java:291) >> at org.jruby.Ruby.eval(Ruby.java:188) >> at org.jruby.Main.runInterpreter(Main.java:152) >> at org.jruby.Main.runInterpreter(Main.java:121) >> at org.jruby.Main.main(Main.java:82) >> >> >> >> >> ------------------------------------------------------- >> This SF.Net email is sponsored by xPML, a groundbreaking scripting >> languagethat extends applications into web and mobile media. Attend >> the live webcast >> and join the prime developer group breaking into this new coding >> territory!http://sel.as- >> > us.falkag.net/sel?cmdgk&kid0944&bid$1720&dat1642_______________________________________________ >> Jruby-devel mailing list >> Jruby-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/jruby-devel >> > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting > language > that extends applications into web and mobile media. Attend the live > webcast > and join the prime developer group breaking into this new coding > territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ > Jruby-devel mailing list > Jruby-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jruby-devel > -- Evan Buswell (831)644-9219 [EMAIL PROTECTED] ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642 _______________________________________________ Jruby-devel mailing list Jruby-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jruby-devel