On 20 December 2013 19:43, MauMau Wrote
> 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
> to be cancelled because the corresponding server process vanished.
> psql could not get out of the loop below in handleCopyIn():
> while (res = PQgetResult(conn), PQresultStatus(res) == PGRES_COPY_IN)
> OK = false;
> 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 steps explained.
1. Make pqsecure_write to return less byte(by updating the result while
debugging in gdb in pqSendSome.
(also make sure that remaining byte is >= 8192 i.e conn->outCount-sent
> 8192 , so that in next step pqPutMsgEnd called from PQputCopyEnd go for
flushing the data)
2. Then Kill the backend process before it calls pqReadData.
Scenario reproduced without patch and after applying the patch issue
Is there any direct scenario by which it can be reproduce ?
Sent via pgsql-hackers mailing list (firstname.lastname@example.org)
To make changes to your subscription: