You are fast! :) http://jira.codehaus.org/browse/JRUBY-2477
Thanks, Charles. Peter -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charles Oliver Nutter Sent: Wednesday, April 30, 2008 1:06 AM To: [email protected] Subject: Re: [jruby-dev] ClassCastException in JRuby 1.1.1 Charles Oliver Nutter wrote: > Charles Oliver Nutter wrote: >> Peter K Chan wrote: >>> I am receiving some occasional ClassCastException in my JRuby 1.1.1 app. >> ... >>> Since the exception directly kills the thread, I don't have a Ruby >>> stack trace to guess what piece of Ruby code caused the exception. >>> Full Java >>> stack trace is attached. Any idea what the problem may be? >> >> It looks like the method handle for Symbol#to_s is getting used to >> call against a String somewhere...but I'm not sure how that would >> happen. Toss the traces into a bug and I'll have a look. > > You know, it occurs to me now, you might be the first to have found a > potential thread unsafety in CallSite. I'd theorized it was there but > was never able to reproduce it. > > The theory is this: If there are multiple calls coming into a call site > on different threads at different times, one thread may retrieve and > cache a method after the other thread has done the same but not yet made > its call yet. This would cause the method for one type of object to get > called against another, ending up in a class cast. Since it sounds like > your app is heavily threaded, I bet this is the case. > > Get that bug file with whatever full traces you can provide and I'll > test the theory. It would fast-track us getting CallSite fixed. Yup, I can reproduce it...that's the problem: def foo(a) a.to_s end a = :foo b = "foo" 10.times { Thread.new { loop { foo(a); foo(b) } } } sleep Thinking through a solution now. - Charlie --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
