Re: [INTERFACES] firewall crashes backend

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [INTERFACES] firewall crashes backend
Дата
Msg-id 1503.936831957@sss.pgh.pa.us
обсуждение исходный текст
Ответ на firewall crashes backend  ("Ken J. Wright" <ken@ori-ind.com>)
Ответы Re: [INTERFACES] firewall crashes backend  ("Ken J. Wright" <ken@ori-ind.com>)
Re: [INTERFACES] firewall crashes backend  ("Ken J. Wright" <ken@ori-ind.com>)
Список pgsql-interfaces
"Ken J. Wright" <ken@ori-ind.com> writes:
> When connecting to postgresql 6.5.1 through a socks5 firewall via ODBC, the
> following error occurs:
> ERROR: postmaster: StreamConnection: accept: No route to host
> Then the backend crashes.

Ken, here is a patch.  I can't test it very well since I don't have any
easy way of provoking a failure at this stage of the connection.  Would
you check it?

Line numbers are for 6.5, but it should apply against current with a
few lines' offset, if you are using current.
        regards, tom lane


*** src/backend/libpq/pqcomm.c.orig    Wed Jul  7 13:17:47 1999
--- src/backend/libpq/pqcomm.c    Wed Sep  8 19:00:51 1999
***************
*** 339,344 ****
--- 339,348 ----  *        the Postmaster uses select() to tell when the server master  *        socket is ready for
accept(). *
 
+  * NB: this can NOT call elog() because it is invoked in the postmaster,
+  * not in standard backend context.  If we get an error, the best we can do
+  * is log it to stderr.
+  *  * RETURNS: STATUS_OK or STATUS_ERROR  */ int
***************
*** 352,358 ****                              (struct sockaddr *) & port->raddr,
&addrlen))< 0)     {
 
!         elog(ERROR, "postmaster: StreamConnection: accept: %m");         return STATUS_ERROR;     } 
--- 356,362 ----                              (struct sockaddr *) & port->raddr,
&addrlen))< 0)     {
 
!         perror("postmaster: StreamConnection: accept");         return STATUS_ERROR;     } 
***************
*** 361,367 ****     if (getsockname(port->sock, (struct sockaddr *) & port->laddr,                     &addrlen) < 0)
  {
 
!         elog(ERROR, "postmaster: StreamConnection: getsockname: %m");         return STATUS_ERROR;     } 
--- 365,371 ----     if (getsockname(port->sock, (struct sockaddr *) & port->laddr,                     &addrlen) < 0)
  {
 
!         perror("postmaster: StreamConnection: getsockname");         return STATUS_ERROR;     } 
***************
*** 374,386 ****         pe = getprotobyname("TCP");         if (pe == NULL)         {
!             elog(ERROR, "postmaster: getprotobyname failed");             return STATUS_ERROR;         }         if
(setsockopt(port->sock,pe->p_proto, TCP_NODELAY,                        &on, sizeof(on)) < 0)         {
 
!             elog(ERROR, "postmaster: setsockopt failed: %m");             return STATUS_ERROR;         }     }
--- 378,390 ----         pe = getprotobyname("TCP");         if (pe == NULL)         {
!             perror("postmaster: StreamConnection: getprotobyname");             return STATUS_ERROR;         }
if (setsockopt(port->sock, pe->p_proto, TCP_NODELAY,                        &on, sizeof(on)) < 0)         {
 
!             perror("postmaster: StreamConnection: setsockopt");             return STATUS_ERROR;         }     }


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

Предыдущее
От: "Ken J. Wright"
Дата:
Сообщение: Re: [INTERFACES] firewall crashes backend
Следующее
От: Mark Gaschermann
Дата:
Сообщение: Re: [INTERFACES] PGACCESS formdemo.sql