[Patch] PQconnectPoll() is blocked if target_session_attrs is read-write

From: "Matsumura, Ryo" <matsumura(dot)ryo(at)jp(dot)fujitsu(dot)com>
To: "Matsumura, Ryo" <matsumura(dot)ryo(at)jp(dot)fujitsu(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: [Patch] PQconnectPoll() is blocked if target_session_attrs is read-write
Date: 2019-07-22 02:28:22
Message-ID: 03040DFF97E6E54E88D3BFEE5F5480F74AC15BBD@G01JPEXMBYT04
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

# I rewrote my previous mail.

PQconnectPoll() is used as method for asynchronous using externally or internally.
If a caller confirms a socket ready for writing or reading that is
requested by return value of previous PQconnectPoll(), next PQconnectPoll()
must not be blocked. But if the caller specifies target_session_attrs to
'read-write', PQconnectPoll() may be blocked.

Detail:
If target_session_attrs is set to read-write, PQconnectPoll() calls
PQsendQuery("SHOW transaction_read_only") althogh previous return value was
PGRES_POLLING_READING not WRITING.
In result, PQsendQuery() may be blocked in pqsecure_raw_write().

I attach a patch.

Regards
Ryo Matsumura

Attachment Content-Type Size
libpq_state_change_bugfix.ver1.0.patch application/octet-stream 3.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2019-07-22 02:29:33 Re: Speed up transaction completion faster after many relations are accessed in a transaction
Previous Message Tsunakawa, Takayuki 2019-07-22 02:21:16 RE: Speed up transaction completion faster after many relations are accessed in a transaction