pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ken J. Wright <ken@ori-ind.com>
Cc: pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] firewall crashes backend
Date: Wed, 08 Sep 1999 19:05:57 -0400
Message-ID: <1503.936831957@sss.pgh.pa.us> (raw)
In-Reply-To: <3.0.1.32.19990908133125.0095bb50@ori-ind.com>

"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


inline patch 1: src/backend/libpq/pqcomm.c (+8/-4 lines) download inline-1.patch*** 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; } }

view thread (7+ messages)  latest in thread

Message-ID: <1503.936831957@sss.pgh.pa.us>
Permalink:  ../1503.936831957@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1503.936831957@sss.pgh.pa.us

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: tgl@sss.pgh.pa.us, ken@ori-ind.com
  Subject: Re: [INTERFACES] firewall crashes backend
  In-Reply-To: <1503.936831957@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox