libpq endless loop if client_min_messages=debug1

From: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>
To: mydeja(at)achimota(dot)com
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>, pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: libpq endless loop if client_min_messages=debug1
Date: 2003-12-28 11:31:42
Message-ID: 3FEEBF1E.3050302@pse-consulting.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers pgadmin-support 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

Attachment Content-Type Size
fe-protocol3.c.patch text/plain 545 bytes

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Tom Lane 2003-12-28 16:25:10 Re: [PATCHES] libpq endless loop if client_min_messages=debug1
Previous Message Raphaël Enrici 2003-12-26 16:10:54 Re: [HELP bug] (control lost) while in create table

Browse pgadmin-support by date

  From Date Subject
Next Message Jean-Michel POURE 2003-12-28 13:26:27 Re: SuSE 9.0 ... Works!
Previous Message Raphaël Enrici 2003-12-27 22:05:27 Re: SuSE 9.0 ... Works!

Browse pgsql-patches by date

  From Date Subject
Next Message Tony Reina 2003-12-28 13:54:30 Re: Connecting to Postgres
Previous Message Claudio Natoli 2003-12-28 10:34:49 Re: fork/exec patch: pre-CreateProcess finalization