Re: Bug in TypeInfoCache causes getObject to fail

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: Bug in TypeInfoCache causes getObject to fail
Дата
Msg-id Pine.BSO.4.61.0602091120040.31185@leary.csoft.net
обсуждение исходный текст
Ответ на Bug in TypeInfoCache causes getObject to fail  (till toenges <tt@kyon.de>)
Ответы Re: Bug in TypeInfoCache causes getObject to fail
Список pgsql-jdbc

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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: "Kevin Grittner"
Дата:
Сообщение: Re: PGobject returned from ResultSet.getObject
Следующее
От: Kris Jurka
Дата:
Сообщение: New releases for 8.0, 8.1, and 8.2dev