Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #5063 > unrolled thread

jruby --1.9 : Exception in thread "RubyThread-1: threadtest.rb:1" java.lang.LinkageError: loader (instance of org/jruby/util/JRubyClassLoader): attempted duplicate class definition for name: "threadtest$block_0$RUBY$true?"

Started byMarkus Fischer <markus@fischer.name>
First post2011-05-25 16:34 -0500
Last post2011-06-10 02:38 -0500
Articles 6 — 2 participants

Back to article view | Back to comp.lang.ruby


Contents

  jruby --1.9 : Exception in thread "RubyThread-1: threadtest.rb:1" java.lang.LinkageError: loader (instance of org/jruby/util/JRubyClassLoader): attempted  duplicate class definition for name: "threadtest$block_0$RUBY$true?" Markus Fischer <markus@fischer.name> - 2011-05-25 16:34 -0500
    Re: jruby --1.9 : Exception in thread "RubyThread-1: threadtest.rb:1" java.lang.LinkageError: loader (instance of org/jruby/util/JRubyClassLoader): attempted duplicate class definition for name: "threadtest$block_0$RUBY$true?" Charles Oliver Nutter <headius@headius.com> - 2011-06-03 11:51 -0500
      Re: jruby --1.9 : Exception in thread "RubyThread-1: threadtest.rb:1" java.lang.LinkageError: loader (instance of org/jruby/util/JRubyClassLoader): attempted duplicate class definition for name: "threadtest$block_0$RUBY$true?" Markus Fischer <markus@fischer.name> - 2011-06-05 10:41 -0500
        Re: jruby --1.9 : Exception in thread "RubyThread-1: threadtest.rb:1" java.lang.LinkageError: loader (instance of org/jruby/util/JRubyClassLoader): attempted duplicate class definition for name: "threadtest$block_0$RUBY$true?" Charles Oliver Nutter <headius@headius.com> - 2011-06-08 02:30 -0500
          Re: jruby --1.9 : Exception in thread "RubyThread-1: threadtest.rb:1" java.lang.LinkageError: loader (instance of org/jruby/util/JRubyClassLoader): attempted duplicate class definition for name: "threadtest$block_0$RUBY$true?" Markus Fischer <markus@fischer.name> - 2011-06-08 07:34 -0500
            Re: jruby --1.9 : Exception in thread "RubyThread-1: threadtest.rb:1" java.lang.LinkageError: loader (instance of org/jruby/util/JRubyClassLoader): attempted duplicate class definition for name: "threadtest$block_0$RUBY$true?" Charles Oliver Nutter <headius@headius.com> - 2011-06-10 02:38 -0500

#5063 — jruby --1.9 : Exception in thread "RubyThread-1: threadtest.rb:1" java.lang.LinkageError: loader (instance of org/jruby/util/JRubyClassLoader): attempted duplicate class definition for name: "threadtest$block_0$RUBY$true?"

FromMarkus Fischer <markus@fischer.name>
Date2011-05-25 16:34 -0500
Subjectjruby --1.9 : Exception in thread "RubyThread-1: threadtest.rb:1" java.lang.LinkageError: loader (instance of org/jruby/util/JRubyClassLoader): attempted duplicate class definition for name: "threadtest$block_0$RUBY$true?"
Message-ID<4DDD75A6.1030608@fischer.name>
Hi,

the following script works under MRI 1.9, but not under jruby 1.9 (but
in jruby 1.8):

require 'thread'

class MutexedBoolean
    def initialize(initial_value)
        @value = initial_value
        @mutex = Mutex.new
    end
    def true?
        @mutex.synchronize do
            @value == true
        end
    end
end

threads = []

run = MutexedBoolean.new(true)

Thread.abort_on_exception = true

threads << Thread.new do
    while run.true?
        puts "1"
        sleep 1
    end
end

threads << Thread.new do
    while run.true?
        puts "2"
        sleep 1
    end
end

threads.each { |t| t.join }


Here's the stacktrace I'm getting. Only the first thread runs:

Exception in thread "RubyThread-1: threadtest.rb:1"
java.lang.LinkageError: loader (instance of
org/jruby/util/JRubyClassLoader): attempted  duplicate class definition
for name: "threadtest$block_0$RUBY$true?"
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
        at
org.jruby.util.JRubyClassLoader.defineClass(JRubyClassLoader.java:76)
        at
org.jruby.internal.runtime.methods.InvocationMethodFactory.endClassWithBytes(InvocationMethodFactory.java:1358)
        at
org.jruby.internal.runtime.methods.InvocationMethodFactory.getBlockCallback19(InvocationMethodFactory.java:899)
        at
org.jruby.javasupport.util.RuntimeHelpers.createBlockCallback19(RuntimeHelpers.java:177)
        at
org.jruby.javasupport.util.RuntimeHelpers.createCompiledBlockBody19(RuntimeHelpers.java:292)
        at
org.jruby.javasupport.util.RuntimeHelpers.createCompiledBlockBody19(RuntimeHelpers.java:282)
        at
org.jruby.ast.executable.RuntimeCache.createBlockBody19(RuntimeCache.java:442)
        at
org.jruby.ast.executable.RuntimeCache.getBlockBody19(RuntimeCache.java:85)
        at
org.jruby.ast.executable.AbstractScript.getBlockBody190(AbstractScript.java:106)
        at threadtest.method__2$RUBY$true_p_(threadtest.rb:9)
        at
threadtest$method__2$RUBY$true_p_.call(threadtest$method__2$RUBY$true_p_:65535)
        at
threadtest$method__2$RUBY$true_p_.call(threadtest$method__2$RUBY$true_p_:65535)
        at
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:262)
        at
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:105)
        at threadtest.block_2$RUBY$__file__(threadtest.rb:31)
        at
threadtest$block_2$RUBY$__file__.call(threadtest$block_2$RUBY$__file__:65535)
        at org.jruby.runtime.CompiledBlock19.yield(CompiledBlock19.java:154)
        at org.jruby.runtime.CompiledBlock19.call(CompiledBlock19.java:82)
        at org.jruby.runtime.Block.call(Block.java:89)
        at org.jruby.RubyProc.call(RubyProc.java:268)
        at org.jruby.RubyProc.call(RubyProc.java:232)
        at org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:95)
        at java.lang.Thread.run(Thread.java:662)

If I remove the @mutex check in true?, it works in jruby 1.9.

thanks,
- Markus

[toc] | [next] | [standalone]


#5360 — Re: jruby --1.9 : Exception in thread "RubyThread-1: threadtest.rb:1" java.lang.LinkageError: loader (instance of org/jruby/util/JRubyClassLoader): attempted duplicate class definition for name: "threadtest$block_0$RUBY$true?"

FromCharles Oliver Nutter <headius@headius.com>
Date2011-06-03 11:51 -0500
SubjectRe: jruby --1.9 : Exception in thread "RubyThread-1: threadtest.rb:1" java.lang.LinkageError: loader (instance of org/jruby/util/JRubyClassLoader): attempted duplicate class definition for name: "threadtest$block_0$RUBY$true?"
Message-ID<BANLkTikWj8O6OMiOUgDNYJ7_DwzWsJWmCw@mail.gmail.com>
In reply to#5063
That's wacked. Please file a bug at http://bugs.jruby.org. Looks like
a class name we're generating internally is not getting handled
properly.

On Wed, May 25, 2011 at 4:34 PM, Markus Fischer <markus@fischer.name> wrote:
> Hi,
>
> the following script works under MRI 1.9, but not under jruby 1.9 (but
> in jruby 1.8):
>
> require 'thread'
>
> class MutexedBoolean
>    def initialize(initial_value)
>        @value = initial_value
>        @mutex = Mutex.new
>    end
>    def true?
>        @mutex.synchronize do
>            @value == true
>        end
>    end
> end
>
> threads = []
>
> run = MutexedBoolean.new(true)
>
> Thread.abort_on_exception = true
>
> threads << Thread.new do
>    while run.true?
>        puts "1"
>        sleep 1
>    end
> end
>
> threads << Thread.new do
>    while run.true?
>        puts "2"
>        sleep 1
>    end
> end
>
> threads.each { |t| t.join }
>
>
> Here's the stacktrace I'm getting. Only the first thread runs:
>
> Exception in thread "RubyThread-1: threadtest.rb:1"
> java.lang.LinkageError: loader (instance of
> org/jruby/util/JRubyClassLoader): attempted  duplicate class definition
> for name: "threadtest$block_0$RUBY$true?"
>        at java.lang.ClassLoader.defineClass1(Native Method)
>        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
>        at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
>        at
> org.jruby.util.JRubyClassLoader.defineClass(JRubyClassLoader.java:76)
>        at
> org.jruby.internal.runtime.methods.InvocationMethodFactory.endClassWithBytes(InvocationMethodFactory.java:1358)
>        at
> org.jruby.internal.runtime.methods.InvocationMethodFactory.getBlockCallback19(InvocationMethodFactory.java:899)
>        at
> org.jruby.javasupport.util.RuntimeHelpers.createBlockCallback19(RuntimeHelpers.java:177)
>        at
> org.jruby.javasupport.util.RuntimeHelpers.createCompiledBlockBody19(RuntimeHelpers.java:292)
>        at
> org.jruby.javasupport.util.RuntimeHelpers.createCompiledBlockBody19(RuntimeHelpers.java:282)
>        at
> org.jruby.ast.executable.RuntimeCache.createBlockBody19(RuntimeCache.java:442)
>        at
> org.jruby.ast.executable.RuntimeCache.getBlockBody19(RuntimeCache.java:85)
>        at
> org.jruby.ast.executable.AbstractScript.getBlockBody190(AbstractScript.java:106)
>        at threadtest.method__2$RUBY$true_p_(threadtest.rb:9)
>        at
> threadtest$method__2$RUBY$true_p_.call(threadtest$method__2$RUBY$true_p_:65535)
>        at
> threadtest$method__2$RUBY$true_p_.call(threadtest$method__2$RUBY$true_p_:65535)
>        at
> org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:262)
>        at
> org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:105)
>        at threadtest.block_2$RUBY$__file__(threadtestrb:31)
>        at
> threadtest$block_2$RUBY$__file__.call(threadtest$block_2$RUBY$__file__:65535)
>        at org.jruby.runtime.CompiledBlock19.yield(CompiledBlock19.java:154)
>        at org.jruby.runtime.CompiledBlock19.call(CompiledBlock19.java:82)
>        at org.jruby.runtime.Block.call(Block.java:89)
>        at org.jruby.RubyProc.call(RubyProc.java:268)
>        at org.jruby.RubyProc.call(RubyProc.java:232)
>        at org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:95)
>        at java.lang.Thread.run(Thread.java:662)
>
> If I remove the @mutex check in true?, it works in jruby 1.9.
>
> thanks,
> - Markus
>
>

[toc] | [prev] | [next] | [standalone]


#5412 — Re: jruby --1.9 : Exception in thread "RubyThread-1: threadtest.rb:1" java.lang.LinkageError: loader (instance of org/jruby/util/JRubyClassLoader): attempted duplicate class definition for name: "threadtest$block_0$RUBY$true?"

FromMarkus Fischer <markus@fischer.name>
Date2011-06-05 10:41 -0500
SubjectRe: jruby --1.9 : Exception in thread "RubyThread-1: threadtest.rb:1" java.lang.LinkageError: loader (instance of org/jruby/util/JRubyClassLoader): attempted duplicate class definition for name: "threadtest$block_0$RUBY$true?"
Message-ID<4DEBA38E.8070502@fischer.name>
In reply to#5360
On 03.06.2011 18:51, Charles Oliver Nutter wrote:
> That's wacked. Please file a bug at http://bugs.jruby.org. Looks like
> a class name we're generating internally is not getting handled
> properly.

You can find it here: http://jira.codehaus.org/browse/JRUBY-5850

- Markus

[toc] | [prev] | [next] | [standalone]


#5487 — Re: jruby --1.9 : Exception in thread "RubyThread-1: threadtest.rb:1" java.lang.LinkageError: loader (instance of org/jruby/util/JRubyClassLoader): attempted duplicate class definition for name: "threadtest$block_0$RUBY$true?"

FromCharles Oliver Nutter <headius@headius.com>
Date2011-06-08 02:30 -0500
SubjectRe: jruby --1.9 : Exception in thread "RubyThread-1: threadtest.rb:1" java.lang.LinkageError: loader (instance of org/jruby/util/JRubyClassLoader): attempted duplicate class definition for name: "threadtest$block_0$RUBY$true?"
Message-ID<BANLkTi=ZPe7+3rCzuQZxVLLn+_u6Sm90iQ@mail.gmail.com>
In reply to#5412
On Sun, Jun 5, 2011 at 10:41 AM, Markus Fischer <markus@fischer.name> wrote:
> On 03.06.2011 18:51, Charles Oliver Nutter wrote:
>> That's wacked. Please file a bug at http://bugs.jruby.org. Looks like
>> a class name we're generating internally is not getting handled
>> properly.
>
> You can find it here: http://jira.codehaus.org/browse/JRUBY-5850

Fixed! Sorry I didn't update the bug until now; couldn't remember
where I'd seen this email until today :)

- Charlie

[toc] | [prev] | [next] | [standalone]


#5490 — Re: jruby --1.9 : Exception in thread "RubyThread-1: threadtest.rb:1" java.lang.LinkageError: loader (instance of org/jruby/util/JRubyClassLoader): attempted duplicate class definition for name: "threadtest$block_0$RUBY$true?"

FromMarkus Fischer <markus@fischer.name>
Date2011-06-08 07:34 -0500
SubjectRe: jruby --1.9 : Exception in thread "RubyThread-1: threadtest.rb:1" java.lang.LinkageError: loader (instance of org/jruby/util/JRubyClassLoader): attempted duplicate class definition for name: "threadtest$block_0$RUBY$true?"
Message-ID<4DEF6C5D.6090701@fischer.name>
In reply to#5487
On 08.06.2011 09:30, Charles Oliver Nutter wrote:
> On Sun, Jun 5, 2011 at 10:41 AM, Markus Fischer<markus@fischer.name>  wrote:
>> On 03.06.2011 18:51, Charles Oliver Nutter wrote:
>>> That's wacked. Please file a bug at http://bugs.jruby.org. Looks like
>>> a class name we're generating internally is not getting handled
>>> properly.
>>
>> You can find it here: http://jira.codehaus.org/browse/JRUBY-5850
>
> Fixed! Sorry I didn't update the bug until now; couldn't remember
> where I'd seen this email until today :)

:-)

I'm happy this is solved! You don't happen to have a time frame for 
1.6.3 release? ;)

thanks,
- Markus

[toc] | [prev] | [next] | [standalone]


#5549 — Re: jruby --1.9 : Exception in thread "RubyThread-1: threadtest.rb:1" java.lang.LinkageError: loader (instance of org/jruby/util/JRubyClassLoader): attempted duplicate class definition for name: "threadtest$block_0$RUBY$true?"

FromCharles Oliver Nutter <headius@headius.com>
Date2011-06-10 02:38 -0500
SubjectRe: jruby --1.9 : Exception in thread "RubyThread-1: threadtest.rb:1" java.lang.LinkageError: loader (instance of org/jruby/util/JRubyClassLoader): attempted duplicate class definition for name: "threadtest$block_0$RUBY$true?"
Message-ID<BANLkTinE7R6xBUvsSXdTgsAEDhQ7z7VNvg@mail.gmail.com>
In reply to#5490
On Wed, Jun 8, 2011 at 7:34 AM, Markus Fischer <markus@fischer.name> wrote:
> :-)
>
> I'm happy this is solved! You don't happen to have a time frame for 1.6.3
> release? ;)

Soonish? :)

- Charlie

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.ruby


csiph-web