Re: Bug

Dion Picco <[email protected]> Wed, 18 May 2005 12:31:58 -0230
Newsgroups gmane.comp.corba.orbacus
Organization IONA | Making Software Work Together TM
Message-ID <[email protected]>
Hi Erez,

On Sun, Apr 17, 2005 at 07:47:08PM +0300, Erez Hadad wrote:
> Hi,
> 
> I'm using JOB-4.1.3 (Linux/JDK1.4.2). I think I may have just recovered and 
> fixed a bug in ob/src/com/ooc/PortableInterceptor/Current_impl.java: the 
> private member stateKey_ is defined as an un-synchronized WeakHashMap. Thus 
> calls to establishTSD() by multiple threads may create a race condition in 
> which one thread changes the map while another accesses it. According to the 
> JDK documentation, this is a forbidden situation and it might result in an 
> erratic behavior. In my case, I found this as my server crashed with the 
> exception in the attached file log.txt
> 
> My explanation is as following: when two or more threads access the stateKey_ 
> map simultaneously in establishTSD(), a reader thread might get a null value 
> although it has a valid entry in the map. Next, the reader thread creates a 
> new stack entry (since it got null) with a single element. If the reader 
> thread called establishTSD() from within _OB_popSlotData() then the new stack 
> returned has its single element removed. As a result, it becomes empty and 
> the assertion in line 173 fails.
> 
> I have fixed this problem by replacing line 46 with the following line:
>     private java.util.Map stateKey_ = 
> java.util.Collections.synchronizedMap(new java.util.WeakHashMap());
> 
> Please verify the bug and its fix. I know it exists in JOB-4.2.2 as well.
> 
> Sincerely,
> Erez Hadad
> 

I'm sorry for the delay in response - we are working hard on the next
release of Orbacus so it took a while before I could test/verify your
report.  I want to thank you for spotting this (as well as a recommended
solution).  I have implemented your changes into the next release of
Orbacus.
Cheers!

-- 
Dion Picco, Software Engineer
IONA Technologies Inc.
Team Orbacus - Your CORBA Source
mailto:[email protected]
http://www.orbacus.com
_______________________________________________
OB-Users Mailing List - [email protected]
http://mail.ooc.nf.ca/mailman/listinfo/ob-users
Visit our support FAQ before you send a message.
http://www.orbacus.com/faq/support.html