Re: BUG #2724: Could not check connection status with "ssl=on"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Alexey Zayats" <alexey(dot)zayats(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2724: Could not check connection status with "ssl=on"
Date: 2006-10-27 16:53:52
Message-ID: 6900.1161968032@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers pgsql-patches

"Alexey Zayats" <alexey(dot)zayats(at)gmail(dot)com> writes:
> I've got next backtrace from core file:
> --------------------------
> Program received signal SIGPIPE, Broken pipe.
> [Switching to Thread 46912549615488 (LWP 28743)]
> 0x00002aaaad07ae32 in __write_nocancel () from /lib64/tls/libpthread.so.0
> (gdb) bt
> #0 0x00002aaaad07ae32 in __write_nocancel () from
> /lib64/tls/libpthread.so.0
> #1 0x00002aaaad9e2187 in BIO_sock_should_retry ()
> from /usr/lib64/libcrypto.so.0.9.7
> #2 0x00002aaaad9e0751 in BIO_write () from /usr/lib64/libcrypto.so.0.9.7
> #3 0x00002aaaad82b8a4 in ssl3_change_cipher_state ()
> from /usr/lib64/libssl.so.0.9.7
> #4 0x00002aaaad82b9a2 in ssl3_dispatch_alert ()
> from /usr/lib64/libssl.so.0.9.7
> #5 0x00002aaaad82a084 in ssl3_shutdown () from /usr/lib64/libssl.so.0.9.7
> #6 0x00002aaaaaec4095 in close_SSL () from /usr/local/lib/libpq.so.4
> #7 0x00002aaaaaebd408 in pqReadData () from /usr/local/lib/libpq.so.4

I would argue that this is an OpenSSL bug: it should not be trying to
write on a connection that it knows perfectly well is already dead.
(It should know that, anyway, because the only way that pqReadData would
be trying to close the connection is that it got an error indication
from OpenSSL.)

Possibly we could work around the problem by disabling SIGPIPE during
connection close, but I don't really see why we should have to do that.

> Before any queries send, i'm using isOpen method that looks like:
> --
> bool QPSQLDriver::isOpen() const
> {
> return PQstatus(d->connection) == CONNECTION_OK;
> }

That's pretty much a waste of time, because all it tells you is whether
the connection was good the last time a query was done. It is *not*
intended as an active "ping".

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Henrique Lavnis // iKernelTech 2006-10-27 17:43:53 Drive ODBC
Previous Message Thomas H. 2006-10-27 14:30:57 Re: BUG #2712: could not fsync segment: Permission

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 2006-10-27 19:40:49 qsort->pg_qsort in 8.2
Previous Message Peter Eisentraut 2006-10-27 16:49:34 Re: bug in on_error_rollback !?

Browse pgsql-patches by date

  From Date Subject
Next Message Simon Riggs 2006-10-27 21:19:54 Re: [HACKERS] WAL logging freezing
Previous Message Tom Lane 2006-10-27 16:01:12 Re: WAL logging freezing