Hi, I am using JRuby 1.1.6 and java 1.6 64 bit on Ubuntu 8.10. When
ever I
try to run autotest (jruby -S autotest --rails) I get an objectspace
error.
/usr/local/share/jruby-1.1.6/lib/ruby/gems/1.8/gems/ZenTest-3.11.1/lib/zentest.rb:5:in each_object': ObjectSpace is disabled; each_object will only work with Class, pass +O to enable (RuntimeError) from /usr/local/share/jruby-1.1.6/lib/ruby/gems/1.8/gems/ZenTest-3.11.1/lib/zentest.rb:5 from /usr/local/share/jruby-1.1.6/lib/ruby/gems/1.8/gems/ZenTest-3.11.1/lib/zentest.rb:31:inrequire’
from
/usr/local/share/jruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require' from /usr/local/share/jruby-1.1.6/lib/ruby/gems/1.8/gems/ZenTest-3.11.1/bin/unit_diff:18 from /usr/local/share/jruby-1.1.6/lib/ruby/gems/1.8/gems/ZenTest-3.11.1/bin/unit_diff:19:inload’
from /usr/local/share/jruby/bin/unit_diff:19
I have tried passing in -X+O and/or -J-Djruby.objectspace.enabled=true
but I
still get the same error as ubove. Also a couple of days ago I tried
this
with a build of edge JRbuy but I got the same exception. Can anybody
help
me know how to fix this?
I have tried passing in -X+O and/or -J-Djruby.objectspace.enabled=true
but I still get the same error as ubove. Also a couple of days ago I
tried this with a build of edge JRbuy but I got the same exception. Can
anybody help me know how to fix this?
My guess is that ZenTest is not passing along -X+C to the subprocesses
it launchers. I’m rather surprised ZenTest uses ObjectSpace to begin
with. Can you figure out where/how ZenTest does its subprocess
launching? Perhaps we can get Ryan to include a flag for us, or else
find a way to get the flag to propagate through.
Hi Charles, Thanks for the suggestion. I got a quick hack working to
enable the object space. However, once I got that enabled I ran into
another problem. I have copied the trace stack and the the line of code
were it fails:
ObjectSpace.each_object(Module) { |m| $stdlib[m.name] = true }
/usr/local/share/jruby/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:in get_proxy_or_package_under_package': invalid package module (ArgumentError) from /usr/local/share/jruby/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:in method_missing’
from
/usr/local/share/jruby-1.2.0RC1/lib/ruby/gems/1.8/gems/ZenTest-4.0.0/lib/zentest.rb:5
from
/usr/local/share/jruby-1.2.0RC1/lib/ruby/gems/1.8/gems/ZenTest-4.0.0/lib/zentest.rb:5:in each_object' from /usr/local/share/jruby-1.2.0RC1/lib/ruby/gems/1.8/gems/ZenTest-4.0.0/lib/zentest.rb:5 from /usr/local/share/jruby-1.2.0RC1/lib/ruby/gems/1.8/gems/ZenTest-4.0.0/lib/zentest.rb:31:in require’
from
/usr/local/share/jruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require' from /usr/local/share/jruby-1.2.0RC1/lib/ruby/gems/1.8/gems/ZenTest-4.0.0/bin/unit_diff:18 from /usr/local/share/jruby-1.2.0RC1/lib/ruby/gems/1.8/gems/ZenTest-4.0.0/bin/unit_diff:19:in load’
from /usr/local/share/jruby/bin/unit_diff:19
On Fri, Mar 6, 2009 at 1:46 AM, Charles Oliver N. <
I have been working on this problem for 2 days now. Probably because of
my
inexperience with JRuby I have been unsuccessful in being able to
reproduce
this in a simple test case. However, I think that it is coming from the
JavaPackageModuleTemplate module. Does this seam like a reasonable
place
for this exception to come from?
/usr/local/share/jruby/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:in get_proxy_or_package_under_package': invalid package module (ArgumentError) from /usr/local/share/jruby/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:inmethod_missing’
If can you suggest away for me to reproduce this (in a simple fashion)?
Thanks so much and sorry to be such an idiot when it comes to debugging
this
exception.
Thanks,
Josh
On Sat, Mar 7, 2009 at 4:21 PM, Charles Oliver N. <
This is caused by #name not being defined for one or more modules.
JRuby
takes this to mean the module in question represents a Java package.
(That’s how package syntax, e.g. java.lang.Object, is implemented –
package
modules are effectively blank-slated, so, for instance, #name would not
be
defined, but would be considered a package name segment instead.)
However, it appears that in this case, some non-package module also has
an
undefined #name method, so when JRuby tries to access it as a package
(by
looking for the instance variable “@package_name”), it fails. Other
tools
(builder, for instance), also blank-slate objects.
I’d consider this a bug in ZenTest; this should fail (though
differently) in
other Ruby implementations as well. The problem can be corrected (in
ZenTest) by modifying the offending statement in one of a couple of
ways:
ObjectSpace.each_object(Module) { |m| $stdlib[m.name] = true if
m.respond_to?:name }
Did this work with earlier versions of ZenTest? I noticed that in
your
first example you used version 3.11.1, while later you used 4.0.0; it’s
not
clear if the same error would have occurred in 3.11.1 with ObjectSpace
enabled.
Did this work with an earlier version of JRuby? If so, it could mean
we’re creating some invalid package modules, or other blank-slated
modules.
Please go ahead and create a JIRA so the issue can be tracked. Thanks.
-Bill
On Sun, Mar 8, 2009 at 10:48 PM, Charles Oliver N. <
Did this work with an earlier version of JRuby? If so, it could mean
we’re creating some invalid package modules, or other blank-slated modules.
BTW, I’m now thinking this is the case, as otherwise the
get_proxy_or_package_under_package method should not be called. (Still,
ZenTest should account for modules with undefined #name methods, since,
in
going through ObjectSpace, it’s accessing them without any knowledge of
what
they are. This is similar to the problem we saw with auto-completion in
IRB.)
Sorry to keep bring this up. But, after getting that error fixed
another
one came along. It is this
/usr/local/share/jruby-1.2.0RC1/lib/ruby/gems/1.8/gems/ZenTest-4.0.0/lib/unit_diff.rb:72:in parse_input': No such file or directory - File not found - -u (Errno::ENOENT) from /usr/local/share/jruby-1.2.0RC1/lib/ruby/gems/1.8/gems/ZenTest-4.0.0/lib/unit_diff.rb:185:inunit_diff’
from
/usr/local/share/jruby-1.2.0RC1/lib/ruby/gems/1.8/gems/ZenTest-4.0.0/lib/unit_diff.rb:56:in unit_diff' from /usr/local/share/jruby-1.2.0RC1/lib/ruby/gems/1.8/gems/ZenTest-4.0.0/bin/unit_diff:38 from /usr/local/share/jruby-1.2.0RC1/lib/ruby/gems/1.8/gems/ZenTest-4.0.0/bin/unit_diff:19:inload’
from /usr/local/share/jruby/bin/unit_diff:19
It comes from this line of code:
while line = input.gets
I have confirmed that input object is, in fact the ARGF object. When
this
object is called from the Rails console it works fine. But for some
reason
in this instance it fails. Does anybody know what might be causing this
exception?
I closed it as won’t fix. Here is the resolve comment:
Mar/09 09:28 AM
I am won’t fixing this. The problem is zentest is assuming all modules
must have a name method. This will not be true for any blankslate
modules or our internal Java package modules. We need test to respond
because something like:
import org.jruby.node.name.FooTest
Would not be possible…
Bill showed the proper change for zentest in an email thread:
ObjectSpace.each_object(Module) { |m| $stdlib[m.name] = true if
m.respond_to?:name }