X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A14EC9DCCD0 for ; Mon, 13 Mar 2006 11:58:28 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75053-04 for ; Mon, 13 Mar 2006 11:58:33 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from fep02.ttnet.net.tr (mail.ttnet.net.tr [212.175.13.129]) by postgresql.org (Postfix) with ESMTP id 523209DCCCF for ; Mon, 13 Mar 2006 11:58:24 -0400 (AST) Received: from alamut ([85.96.109.238]) by fep02.ttnet.net.tr with ESMTP id <20060313155608.UXXK7467.fep02.ttnet.net.tr@alamut>; Mon, 13 Mar 2006 17:56:08 +0200 Date: Mon, 13 Mar 2006 17:55:31 +0200 From: Volkan YAZICI To: Tom Lane Cc: pgsql-interfaces@postgresql.org Subject: Re: Receiving SIGPIPE for PQfinish() Message-ID: <20060313155531.GA191@alamut> References: <20060312112803.GA490@alamut> <29861.1142180334@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="nFreZHaLTZJo0R7j" Content-Disposition: inline In-Reply-To: <29861.1142180334@sss.pgh.pa.us> User-Agent: Mutt/1.4.2.1i X-NAI-Spam-Rules: 1 Rules triggered BAYES_10=-0.7 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.207 required=5 tests=[AWL=-0.591, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, DNS_FROM_RFC_WHOIS=0.879] X-Spam-Score: 2.207 X-Spam-Level: ** X-Archive-Number: 200603/12 X-Sequence-Number: 6068 --nFreZHaLTZJo0R7j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mar 12 11:18, Tom Lane wrote: > pqsecure_write should have disabled SIGPIPE already. You should look > into why that is seemingly not working. When I omit --enable-thread-safety, code doesn't handle in the case of a SIG_ERR return on the call to pqsignal() made from pqsecure_write(). Furthermore, I still couldn't figure out why pqsignal() cannot handle SIGPIPE - despite pqsignal() doesn't return SIG_ERR. (A related small debug output is attached.) Everything works fine when thread safety is enabled. Regards. --nFreZHaLTZJo0R7j Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="pqsignal.gdb" Breakpoint 5, PQfinish (conn=0x0) at fe-connect.c:2030 2030 { # Shutdown postmaster in here. (gdb) c Continuing. Breakpoint 6, pqsecure_write (conn=0x804e208, ptr=0x804e208, len=134537736) at fe-secure.c:406 406 pqsigfunc oldsighandler = pqsignal(SIGPIPE, SIG_IGN); (gdb) n 393 { (gdb) 406 pqsigfunc oldsighandler = pqsignal(SIGPIPE, SIG_IGN); (gdb) Breakpoint 4, pqsignal (signo=5, func=0x804e208) at pqsignal.c:35 35 act.sa_handler = func; (gdb) 28 { (gdb) 35 act.sa_handler = func; (gdb) 36 sigemptyset(&act.sa_mask); (gdb) 28 { (gdb) 36 sigemptyset(&act.sa_mask); (gdb) 28 { (gdb) 36 sigemptyset(&act.sa_mask); (gdb) 38 if (signo != SIGALRM) (gdb) 42 act.sa_flags |= SA_NOCLDSTOP; (gdb) 44 if (sigaction(signo, &act, &oact) < 0) (gdb) 50 return oact.sa_handler; (gdb) 52 } (gdb) pqsecure_write (conn=0x0, ptr=0x0, len=0) at fe-secure.c:480 480 n = send(conn->sock, ptr, len, 0); (gdb) Program received signal SIGPIPE, Broken pipe. 0xffffe410 in ?? () (gdb) --nFreZHaLTZJo0R7j--