authentication_timeout ineffective for replication connections

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: authentication_timeout ineffective for replication connections
Date: 2015-01-13 14:29:04
Message-ID: 20150113142904.GO6299@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I just noticed that authentication_timeout is ineffective for
replication=true type connections. That's because walsender doesn't
register a SIGINT handler and authentication_timeout relies on having
one.

There's no problem with reading the initial startup packet
(ProcessStartupPacket/BackendInitialize) because we use a separate
handler there. But once that's done, before finishing authentication,
WalSndSignals() will have set SIGINT's handler to SIG_IGN.

Demo python program attached. You'll only see the problem if the
authentication method requires a password/addititional packets.

I think we could fix this by simply mapping SIGINT to die() instead
SIG_IGN.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
pgconn.py text/plain 921 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-01-13 15:10:22 Re: Safe memory allocation functions
Previous Message Alexey Bashtanov 2015-01-13 14:24:42 Re: OOM on EXPLAIN with lots of nodes