libpq endless loop if client_min_messages=debug1

Поиск
Список
Период
Сортировка
От Andreas Pflug
Тема libpq endless loop if client_min_messages=debug1
Дата
Msg-id 3FEEBF1E.3050302@pse-consulting.de
обсуждение исходный текст
Ответы Re: libpq endless loop if client_min_messages=debug1  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: libpq endless loop if client_min_messages=debug1  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
My Deja wrote:

>
>> I am trying to get some query trees to appear in the PostgreSQL log
>> and in order to that I have set
>> client_min_messages = DEBUG1  in order to use the following settings
>> debug_print_parse, debug_print_rewritten, or debug_print_plan which
>> are required for the query tree to show up in the log.
>>
>> pgAdmin crashes whenever I set that option. I tried a few times and I
>> am sure of it.
>> I am using PostgreSQL 7.4 under Cygwin on a Windows 2000 machine, but
>> I don't think that has any relevance.
>
I reproduced this problem with 7.5 head backend and libpq under win32
and Linux, and found that the problem is pqParseInput3 expecting a
message length >= 30000 only for message types 'T', 'D' and 'd', but not
'N'. In the case tested above, the message will be 49336 bytes long,
causing an endless loop in PQexecFinish because PQgetResult will deliver
the same broken message forever.

The attached patch fixes this. I wonder if there are additional message
types that might be longer?

Regards,
Andreas
Index: fe-protocol3.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/interfaces/libpq/fe-protocol3.c,v
retrieving revision 1.10
diff -u -r1.10 fe-protocol3.c
--- fe-protocol3.c    29 Nov 2003 19:52:12 -0000    1.10
+++ fe-protocol3.c    28 Dec 2003 11:26:09 -0000
@@ -84,7 +84,7 @@
             return;
         }
         if (msgLength > 30000 &&
-            !(id == 'T' || id == 'D' || id == 'd'))
+            !(id == 'N' || id == 'T' || id == 'D' || id == 'd'))
         {
             handleSyncLoss(conn, id, msgLength);
             return;



В списке pgsql-patches по дате отправления:

Предыдущее
От: Claudio Natoli
Дата:
Сообщение: Re: fork/exec patch: pre-CreateProcess finalization
Следующее
От: Tom Lane
Дата:
Сообщение: Re: libpq endless loop if client_min_messages=debug1