Re: [bug fix] psql \copy doesn't end if backend is killed

Поиск
Список
Период
Сортировка
От Dilip kumar
Тема Re: [bug fix] psql \copy doesn't end if backend is killed
Дата
Msg-id 4205E661176A124FAF891E0A6BA91352659435A2@SZXEML507-MBS.china.huawei.com
обсуждение исходный текст
Ответ на [bug fix] psql \copy doesn't end if backend is killed  ("MauMau" <maumau307@gmail.com>)
Ответы Re: [bug fix] psql \copy doesn't end if backend is killed  ("MauMau" <maumau307@gmail.com>)
Список pgsql-hackers
On 20 December 2013 19:43, MauMau Wrote
> [Problem]
> If the backend is terminated with SIGKILL while psql is running "\copy
> table_name from file_name", the \copy didn't end forever.  I expected
> \copy
> to be cancelled because the corresponding server process vanished.
>
>
> [Cause]
> psql could not get out of the loop below in handleCopyIn():
>
> while (res = PQgetResult(conn), PQresultStatus(res) == PGRES_COPY_IN)
> {
>     OK = false;
>     PQclear(res);
>
>     PQputCopyEnd(pset.db, _("trying to exit copy mode"));
> }


1. Patch applied to git head successfully
2. Problem can occur in some scenario and fix looks fine to me.
3. For testing, I think it's not possible to directly generate such scenario, so I have verified by debugging as the
stepsexplained. 
1. Make pqsecure_write to return less byte(by updating the result while debugging in gdb  in pqSendSome.(also make sure
thatremaining byte is >= 8192 i.e conn->outCount-sent > 8192 , so that in next step pqPutMsgEnd called from
PQputCopyEndgo for flushing the data) 
2. Then Kill the backend process before it calls pqReadData.
Scenario reproduced without patch and after applying the patch issue resolves.

Is there any direct scenario by which it can be reproduce ?

Regards,
Dilip





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

Предыдущее
От: Dean Rasheed
Дата:
Сообщение: Re: WIP patch (v2) for updatable security barrier views
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: WIP patch (v2) for updatable security barrier views