JDK-4835341 : Introspector doesn't synchronize its caches
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.beans
  • Affected Version: 1.4.0,1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: linux,solaris_8
  • CPU: x86,sparc
  • Submitted: 2003-03-20
  • Updated: 2004-04-27
  • Resolved: 2003-09-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.2_05 05Fixed
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
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

WORK AROUND synchronize the call to Introspector.getBeanInfo: synchronized( lock ) { bi = Introspector.getBeanInfo(c); } ###@###.### 2003-09-16
2003-09-16

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