Using ZenTest with Jruby 1.1.6

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?

Thanks,

josh

Josh M. wrote:

/usr/local/share/jruby-1.1.6/lib/ruby/gems/1.8/gems/ZenTest-3.11.1/lib/zentest.rb:31:in

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.

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

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 }

I say there were some similar looking bugs in the bug tracker (
http://jira.codehaus.org/browse/JRUBY-3016 and
http://jira.codehaus.org/browse/JRUBY-3218). However, both seamed fixed
so
I tried 1.2.0-RC1, but I got the same result. Is this a bug with Jruby?
If
so I will report it in the bug tracker.

Thanks,

Josh

/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. <

Josh M. wrote:

I say there were some similar looking bugs in the bug tracker
(http://jira.codehaus.org/browse/JRUBY-3016 and
http://jira.codehaus.org/browse/JRUBY-3218). However, both seamed fixed
so I tried 1.2.0-RC1, but I got the same result. Is this a bug with
Jruby? If so I will report it in the bug tracker.

Looks like a bug all right…please report it and try to reduce it to a
simple case if possible.

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi Charlie,

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. <

Josh M. wrote:

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’

It’s possible this will be enough for us to investigate. Can you put
everything you’ve discovered into a bug please?

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

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:

  1. ObjectSpace.each_object(Module) { |m| $stdlib[m.name] = true if
    m.respond_to?:name }

  2. ObjectSpace.each_object(Module) { |m| $stdlib[m.name] = true rescue
    nil }

A couple of questions:

  1. 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.

  2. 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. <

On Mon, Mar 9, 2009 at 6:16 AM, Bill D. [email protected]
wrote:

  1. 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.)

-Bill

Yes, this happens in both older 3.x and the latest 4.0.0 versions of
ZenTest.

  1. ObjectSpace.each_object(Module) { |m| $stdlib[m.name] = true if
    m.respond_to?:name }

This line fixed the problem thanks. However, I have created a bug for
this
http://jira.codehaus.org/browse/JRUBY-3482. Should I leave it open? Or
close it?

Josh

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?

Thanks,

Josh

Please ignore the last email. This seems to have been corrected in the
development version. Thanks so much for every bodies help!

Josh

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 }

-Tom

On Mon, Mar 9, 2009 at 8:13 AM, Josh M. [email protected] wrote:


Blog: http://www.bloglines.com/blog/ThomasEEnebo
Email: [email protected] , [email protected]


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email