Re: "unexpected EOF" messages

Поиск
Список
Период
Сортировка
От Magnus Hagander
Тема Re: "unexpected EOF" messages
Дата
Msg-id CABUevExSj1+BpSQTC9k998Q7sDBG=rQYhJy7B=k+MguSL8cE5A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: "unexpected EOF" messages  (Magnus Hagander <magnus@hagander.net>)
Ответы Re: "unexpected EOF" messages  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Thu, May 3, 2012 at 7:21 PM, Magnus Hagander <magnus@hagander.net> wrote:
> On Thu, May 3, 2012 at 7:09 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Magnus Hagander <magnus@hagander.net> writes:
>>> On Thu, May 3, 2012 at 5:39 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>>> I could support that with one tweak: it's only DEBUG1 if you don't
>>>> have an open transaction.  Dropping the connection while in a
>>>> transaction *is* an application bug; I don't care how lazy the app
>>>> programmer is feeling.
>>
>>> I agree - that would certainly be a good fix for this one. One
>>> question is do we want something like this:
>>
>>> -                   ereport(COMMERROR,
>>> +                   ereport(IsTransactionState() ? COMMERROR : DEBUG1,
>>>                             (errcode(ERRCODE_PROTOCOL_VIOLATION),
>>>                              errmsg("unexpected EOF on client connection")));
>>
>>> or do we want to make the text of the error message different as well,
>>> saying something like "unexpected EOF on client connection with an
>>> open transaction"?
>>
>> I'd vote for different texts and different SQLSTATEs too, per other
>> discussion.  (I think we'd decided that ERRCODE_PROTOCOL_VIOLATION
>> was a bad choice anyway.)
>>
>> Also, I'm afraid that the above patch probably doesn't work as-is;
>> won't elog.c try to send the DEBUG1 message to the client?  I think
>> you'll need some additional code to shut down error message output
>> first.  Resetting whereToSendOutput is probably sufficient.
>
> Yeah, I didn't go as far as testing it - there's also more than one
> spot where we log it... I'll cook up a patch.

Heh - we already used ERRCODE_CONNECTION_FAILURE on the errors in
copy.c. Since COPY can only happen when there is a transaction
(right?), I just changed those error messages for consistency.

This patch works through my testing - can anyone spot a hole in it still?

The next question is - of course - whether we can sneak this in before beta...

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Advisory locks seem rather broken
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: "unexpected EOF" messages