pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Volkan YAZICI <yazicivo@ttnet.net.tr>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: Receiving SIGPIPE for PQfinish(<broken-connection>)
Date: Mon, 13 Mar 2006 17:55:31 +0200
Message-ID: <20060313155531.GA191@alamut> (raw)
In-Reply-To: <29861.1142180334@sss.pgh.pa.us>
References: <20060312112803.GA490@alamut>
	<29861.1142180334@sss.pgh.pa.us>

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.
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)

Attachments:

  [text/plain] pqsignal.gdb (1.2K, ../20060313155531.GA191@alamut/2-pqsignal.gdb)
  download | inline:
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)

view thread (6+ messages)  latest in thread

Message-ID: <20060313155531.GA191@alamut>
Permalink:  ../20060313155531.GA191@alamut/
Also on:    postgresql.org/message-id/20060313155531.GA191@alamut

 · 

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: yazicivo@ttnet.net.tr, tgl@sss.pgh.pa.us
  Subject: Re: Receiving SIGPIPE for PQfinish(<broken-connection>)
  In-Reply-To: <20060313155531.GA191@alamut>

* 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