United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-4835341 Introspector doesn't synchronize its caches
JDK-4835341 : Introspector doesn't synchronize its caches

Details
Type:
Bug
Submit Date:
2003-03-20
Status:
Closed
Updated Date:
2004-04-27
Project Name:
JDK
Resolved Date:
2003-09-26
Component:
client-libs
OS:
solaris_8,linux
Sub-Component:
java.beans
CPU:
x86,sparc
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.0,1.4.2
Fixed Versions:
1.4.2_05 (05)

Related Reports
Backport:

Sub Tasks

Description

Name: gm110360			Date: 03/20/2003


FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)


FULL OPERATING SYSTEM VERSION :

glibc-2.1.3-22.1
Linux scratchy.west.quiq.com 2.2.20 #2 Fri Mar 22
09:54:08 PST 2002 i686 unknown
Red Hat Linux release 6.2 (Piglet)
VA Linux Release 6.2.4 02/21/01


A DESCRIPTION OF THE PROBLEM :
The java.beans.Introspector class has been changed in 1.4
to use WeakHashMaps for its two caches, beanInfoCache and
declaredMethodCache.  Previously it used Hashtables.

The problem is that WeakHashMap is not synchronized, where
Hashtable is.  It is incorrect to use a WeakHashMap
simultaneously from more than one thread.  Yet that is
exactly what the Introspector methods will do.  These
methods are not synchronized in any way.  If and when more
than one thread calls Introspector.getBeanInfo() at the
same time, for example, the result will be a corrupt cache.

REGRESSION.  Last worked in version 1.3.1

This bug can be reproduced always.
(Review ID: 146134) 
======================================================================

                                    

Comments
EVALUATION

This is a valid concern. The caches are now unsynchronized. This will be adressed in the next major release.
###@###.### 2003-03-24
                                     
2003-03-24
WORK AROUND

synchronize the call to Introspector.getBeanInfo:

	synchronized( lock ) {
		    bi = Introspector.getBeanInfo(c);
	}

###@###.### 2003-09-16
                                     
2003-09-16
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
1.4.2_05
generic
tiger

FIXED IN:
1.4.2_05
tiger

INTEGRATED IN:
1.4.2_05
tiger
tiger-b22

VERIFIED IN:
1.4.2_05


                                     
2004-06-14



Hardware and Software, Engineered to Work Together