Cygwin PostgreSQL postmaster abort problem

Поиск
Список
Период
Сортировка
От Jason Tishler
Тема Cygwin PostgreSQL postmaster abort problem
Дата
Msg-id 20001221142722.A501@dothill.com
обсуждение исходный текст
Ответы Re: Cygwin PostgreSQL postmaster abort problem  (Jason Tishler <Jason.Tishler@dothill.com>)
Список pgsql-ports
While controlling the PostgreSQL JDBC driver with the following JBDC connection
pool manager:

    http://sourceforge.net/projects/protomatter/

I discovered that the Cygwin PostgreSQL postmaster could abort with the
following error message:

    /usr/local/pgsql/bin/postmaster: ServerLoop: select failed: No children

After much tracing of the Cygwin code, I determined that the problem was
not in the Cygwin DLL so I started to examine the relevant area of the
PostgreSQL source.

Fairly quickly, I determined and verified that the problem is in
postmaster's reaper().  When postmaster is blocked on a select() and the
JDBC client drops its connections, reaper() is fired (as a signal handler)
to clean up.  Since it always calls waitpid() one more time than is
actually needed, errno is inadvertently set to ECHILD which overwrites
the EINTR value set by Cygwin's select().  Hence, when select() returns,
postmaster finds errno set to ECHILD (instead of EINTR) and exits.

The attached minimal patch solves this problem for Cygwin and has been
verified not to break PostgreSQL on Red Hat 6.2 Linux.  Note that I did
not surround the added code with Cygwin specific conditional
compilation because I feel that the change is appropriate for all
platforms.

The procedure to apply this patch is as follows:

    $ cd postgresql-7.0.3/src/backend/postmaster
    $ # save attached patch to current directory
    $ patch <Cygwin-1.1.6-PostgreSQL-7.0.3-postmaster.patch

Would someone more intimate with this area of the PostgreSQL source
critically evaluate this patch and let the list know if there is a better
way of fixing this problem?

Thanks,
Jason

--
Jason Tishler
Director, Software Engineering       Phone: +1 (732) 264-8770 x235
Dot Hill Systems Corporation         Fax:   +1 (732) 264-8798
82 Bethany Road, Suite 7             Email: Jason.Tishler@dothill.com
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com

Вложения

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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: [HACKERS] PostgreSQL pre-7.1 Linux/Alpha Status...
Следующее
От: Jason Tishler
Дата:
Сообщение: Re: Postgresql as complete stand alone service