From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-interfaces@postgreSQL.org
To: pgsql-patches@postgreSQL.org
Subject: libpgtcl crashes after backend crash
Date: Tue, 28 Jul 1998 15:06:56 -0400
Message-ID: <6205.901652816@sss.pgh.pa.us> (raw)
The attached patch fixes a problem that I seem to have introduced with
the new support for asynchronous NOTIFY in libpgtcl. With the current
sources, if the backend disconnects unexpectedly then the tcl/tk
application coredumps when control next reaches the idle loop.
Oops.
regards, tom lane
inline patch 1: src/interfaces/libpgtcl/pgtclId.c (+12/-2 lines) download inline-1.patch*** src/interfaces/libpgtcl/pgtclId.c.orig Tue Jun 16 00:10:17 1998
--- src/interfaces/libpgtcl/pgtclId.c Tue Jul 28 14:48:18 1998
***************
*** 471,476 ****
--- 471,477 ----
{
Pg_ConnectionId *connid = (Pg_ConnectionId *) clientData;
Tcl_File handle;
+ int pqsock;
/* We classify SQL notifies as Tcl file events. */
if (!(flags & TCL_FILE_EVENTS)) {
***************
*** 478,484 ****
}
/* Set up to watch for asynchronous data arrival on backend channel */
! handle = Tcl_GetFile((ClientData) PQsocket(connid->conn), TCL_UNIX_FD);
Tcl_WatchFile(handle, TCL_READABLE);
}
--- 479,489 ----
}
/* Set up to watch for asynchronous data arrival on backend channel */
! pqsock = PQsocket(connid->conn);
! if (pqsock < 0)
! return;
!
! handle = Tcl_GetFile((ClientData) pqsock, TCL_UNIX_FD);
Tcl_WatchFile(handle, TCL_READABLE);
}
***************
*** 488,493 ****
--- 493,499 ----
{
Pg_ConnectionId *connid = (Pg_ConnectionId *) clientData;
Tcl_File handle;
+ int pqsock;
/* We classify SQL notifies as Tcl file events. */
if (!(flags & TCL_FILE_EVENTS)) {
***************
*** 499,505 ****
* We use Tcl_FileReady to avoid a useless kernel call
* when no data is available.
*/
! handle = Tcl_GetFile((ClientData) PQsocket(connid->conn), TCL_UNIX_FD);
if (Tcl_FileReady(handle, TCL_READABLE) != 0) {
PQconsumeInput(connid->conn);
}
--- 505,515 ----
* We use Tcl_FileReady to avoid a useless kernel call
* when no data is available.
*/
! pqsock = PQsocket(connid->conn);
! if (pqsock < 0)
! return;
!
! handle = Tcl_GetFile((ClientData) pqsock, TCL_UNIX_FD);
if (Tcl_FileReady(handle, TCL_READABLE) != 0) {
PQconsumeInput(connid->conn);
}
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, pgsql-patches@postgreSQL.org
Subject: Re: libpgtcl crashes after backend crash
In-Reply-To: <6205.901652816@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