From: Kris Jurka <books@ejurka.com>
To: till toenges <tt@kyon.de>
Cc: pgsql-jdbc@postgresql.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> (raw)
In-Reply-To: <43EB1EA4.4000506@kyon.de>
References: <43EB1EA4.4000506@kyon.de>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: books@ejurka.com, tt@kyon.de
Subject: Re: Bug in TypeInfoCache causes getObject to fail
In-Reply-To: <Pine.BSO.4.61.0602091120040.31185@leary.csoft.net>
References: <43EB1EA4.4000506@kyon.de> <Pine.BSO.4.61.0602091120040.31185@leary.csoft.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox