Re: EN_Destructor bug
От | Inoue, Hiroshi |
---|---|
Тема | Re: EN_Destructor bug |
Дата | |
Msg-id | 51007582.3010601@tpf.co.jp обсуждение исходный текст |
Ответ на | EN_Destructor bug (mkocherov <mkocherov@parallels.com>) |
Список | pgsql-odbc |
Thanks for the report. I would take care fo it. regards, Hiroshi Inoue (2013/01/22 22:32), mkocherov wrote: > Hello! > > 1) We observe crashes in psqlodbc.so library from time to time. Crash dumps > typically look like this one: > #0 0x0057f420 in __kernel_vsyscall () > #1 0x09ba7df0 in raise () from /lib/libc.so.6 > #2 0x09ba9701 in abort () from /lib/libc.so.6 > #3 0x09bdebcb in __libc_message () from /lib/libc.so.6 > #4 0x09be6fea in _int_free () from /lib/libc.so.6 > #5 0x09be7329 in free () from /lib/libc.so.6 > #6 0x02c601d0 in EN_Destructor () from /usr/pgsql-9.0/lib/psqlodbc.so > #7 0x02c60224 in PGAPI_FreeEnv () from /usr/pgsql-9.0/lib/psqlodbc.so > #8 0x02c8f3fe in SQLFreeHandle () from /usr/pgsql-9.0/lib/psqlodbc.so > #9 0x00e961e5 in ?? () from /usr/lib/libodbc.so.1 > #10 0x00e9666d in ?? () from /usr/lib/libodbc.so.1 > #11 0x00e96760 in ?? () from /usr/lib/libodbc.so.1 > #12 0x00e9d02e in SQLDisconnect () from /usr/lib/libodbc.so.1 > … > Due to nature of our program it makes frequent connect / disconnects in > parallel threads. ODBC threading level is set to 2, e.g.: > [PostgreSQL] > Description = PostgreSQL driver > Driver = /usr/pgsql-9.0/lib/psqlodbc.so > Setup = /usr/pgsql-9.0/lib/psqlodbc.so > FileUsage = 1 > Threading = 2 > 2) Checking code of driver reveals that it doesn’t protect shared connection > list when making cleanup tasks in EN_Destructor (PGAPI_FreeEnv -> > EN_Destructor). In this function there is no ENTER_CONNS_CS / > LEAVE_CONNS_CS; > 3) In 2005 Tom Hughes > (http://postgresql.1045698.n5.nabble.com/EN-Destructor-bug-td2187457.html) > provided patch that fixed this problem but then his changes were lost > (starting from psqlodbc-08.02.0100 version). > 4) The problem was reproduced on latest stock drivers psqlodbc-09.00.0310 > and psqlodbc-09.01.0200. > 5) When logging to mylog is enrolled then problem is hardly reproduced – it > seems parallels calls are effectively serialized within mylog() function. > 6) Problem is somewhat mitigated by the fact that default threading level in > unixODBC is set to 3 which eventually prevents races in psqlodbc driver. > 7) Patch: > --- environ.c.van 2010-08-21 10:29:19.000000000 +0400 > +++ environ.c 2013-01-17 18:47:12.000000000 +0300 > @@ -583,6 +583,7 @@ > */ > > /* Free any connections belonging to this environment */ > + ENTER_CONNS_CS; > for (lf = 0, nullcnt = 0; lf < conns_count; lf++) > { > if (NULL == conns[lf]) > @@ -603,6 +604,7 @@ > conns = NULL; > conns_count = 0; > } > + LEAVE_CONNS_CS; > DELETE_ENV_CS(self); > free(self); > > Thanks! > > Michael Kocherov > Software Developer > Parallels Automation Maintenance
В списке pgsql-odbc по дате отправления: