-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: javasisst proxy classes not thread safe
PostPosted: Thu Dec 27, 2007 1:35 pm 
Newbie

Joined: Fri Oct 29, 2004 10:29 am
Posts: 4
While load testing our web app, under high concurrency scenarios, I ran into the following exception while trying to invoke a method on a lazy proxy:

Code:
java.lang.NullPointerException
       at javassist.util.proxy.RuntimeSupport$DefaultMethodHandler.invoke(RuntimeSupport.java:37)
       at edu.academyart.model.Post_$$_javassist_2.getTextTitles(Post_$$_javassist_2.java)


I'm not sure if it's a known issue, but I couldn't find a hibernate jira issue that described it. I chased it down to be what I believe is a bug in javassist, described here with a possible patch:

http://www.jboss.com/index.html?module= ... 30#4115630

In essence, the javassist proxy class generated for any entity class, which is shared by all instances of that entity class for the given classloader (and hence usually the entire web-app), has a non-thread-safe way of caching the lookups of methods in the class it's proxying, which can lead to the above NPE under high concurrency. Note that this isn't a case of trying to use a single hibernate session with multiple threads...all sessions sharing the same classloader are using the same proxy class, because javassist caches proxy class creation, and the proxy class is maintaining a static cache which is not threadsafe.

I'm posting it here in case others hit the same exception. It's not a hibernate bug, but it's a bug in a hibernate dependency.


-Clint


Top
 Profile  
 
 Post subject: javassist race condition still not fixed
PostPosted: Tue Sep 16, 2008 1:49 pm 
Newbie

Joined: Tue Sep 16, 2008 1:33 pm
Posts: 2
Location: Boulder, Colorado
I'm having the exact same issue noted here. (http://www.jboss.com/index.html?module= ... 30#4115630)

There were no replies to this issue and the latest version of javassist (3.8.1.GA) still contains the bug. I'm going to building from source and applying the patch myself. I'll post a followup later about whether this solved the problem.


Top
 Profile  
 
 Post subject: the patch fixed our problem
PostPosted: Tue Sep 16, 2008 3:17 pm 
Newbie

Joined: Tue Sep 16, 2008 1:33 pm
Posts: 2
Location: Boulder, Colorado
I downloaded the javassist 3.8.1.GA source and applied the patch given in the referenced post. It appears to have fixed our issue. Hopefully this patch eventually makes it into the javassist source.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.