libpq is not thread safe

Поиск
Список
Период
Сортировка
Искать
От
Zdenek Kotala
Тема
libpq is not thread safe
Дата
Msg-id
1239710070.1289.158.camel@localhost
Список
Дерево обсуждения
libpq is not thread safe Zdenek Kotala <Zdenek.Kotala@Sun.COM>
Re: libpq is not thread safe Tom Lane <tgl@sss.pgh.pa.us>
Re: libpq is not thread safe Zdenek Kotala <Zdenek.Kotala@Sun.COM>
Re: libpq is not thread safe Bruce Momjian <bruce@momjian.us>
Re: libpq is not thread safe Bruce Momjian <bruce@momjian.us>
Re: libpq is not thread safe Zdenek Kotala <Zdenek.Kotala@Sun.COM>
Re: libpq is not thread safe Bruce Momjian <bruce@momjian.us>
Re: libpq is not thread safe Bruce Momjian <bruce@momjian.us>
When postgreSQL is compiled with --thread-safe that libpq should be
thread safe. But it is not true when somebody call fork(). The problem
is that fork() forks only active threads and some mutex can stay locked
by another thread. We use ssl_config mutex which is global.

We need implement atfork handlers to fix this. See 
http://www.opengroup.org/onlinepubs/009695399/functions/pthread_atfork.html

We should add pthread_atfork into _ini libpq section.

Another problem with fork is that new process inherit connections and so
on. Which is not also good, but it is happened also on single threaded
application and developer can fix it in own code. Maybe some notice in
documentation should help what application should do after fork.
Comments?
	Zdenek


В списке pgsql-hackers по дате отправления
От: Marko Kreen
Дата:
От: Teodor Sigaev
Дата:
FAQ