Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

Re: Bug in TypeInfoCache causes getObject to fail


  • From: Kris Jurka <books(at)ejurka(dot)com>
  • To: till toenges <tt(at)kyon(dot)de>
  • Cc: pgsql-jdbc(at)postgresql(dot)org
  • Subject: Re: Bug in TypeInfoCache causes getObject to fail
  • Date: Thu, 9 Feb 2006 11:29:37 -0500 (EST)
  • Message-id: <Pine.BSO.4.61.0602091120040.31185@leary.csoft.net> <text/plain>



On Thu, 9 Feb 2006, till toenges wrote:

i have found a race condition in org.postgresql.jdbc2.TypeInfoCache. A Map is created as a static member, but reinitialized for every new instance of TypeInfoCache. That causes a race condition in ResultSet.getObject(...), which then returns PGobject instead of the correct type. Probably causes other problems as well. I have attached a test case. The test case works best on smp machines (tested on a 4 way), where it fails almost every time.

Nice work.  Applied to 8.1 and HEAD.

Also the maps in TypeInfoCache are created as synchronizedMaps, which is unneccessary, slow and a potential source for further side effects. I have removed that as well, and attached a fixed version of TypeInfoCache from build 404. I leave the application of the fixes to the current and other versions as an exercise to the committer ;-)

Actually it is necessary for the maps to be synchronized because at any time a client may call PGConnection.addDataType which will modify the maps.

Kris Jurka



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group