Edit report at https://bugs.php.net/bug.php?id=40544&edit=1
ID: 40544 Updated by: yohg...@php.net Reported by: kees at tweakers dot net Summary: PostgreSQL connection hangs after die() -Status: Open +Status: Wont fix Type: Bug Package: PostgreSQL related Operating System: Linux (Debian) PHP Version: 5.2CVS-2008-10-31 Block user comment: N Private report: N New Comment: This is caused by COPY FROM STDIN which reads input from stdin. Standard input is controlled by PHP, not pgsql module. Therefore, it will keep reading since STDIN would not reach EOF. I think there aren't any feasible solution for this. If there is, please submit solution. If one would like to use COPY, use pg_copy_from() http://php.net/manual/ja/function.pg-copy-from.php pg_copy_from() may be better to support stream, though. Previous Comments: ------------------------------------------------------------------------ [2012-03-29 10:09:11] yohg...@php.net Old problem, but I suppose this hasn't changed. I prefer to leave this issue as I wrote 5 years ago. Any comments? ------------------------------------------------------------------------ [2008-10-31 10:04:07] kees at tweakers dot net Using the latest snapshots results in the same behaviour; the script hangs and the connection stays open. ------------------------------------------------------------------------ [2007-04-05 07:48:28] tony2...@php.net >'Rollback on shutdown' is like 'Don't flush buffer before closing file'. I disagree, you need to commit everything explicitly. If you didn't commit the transaction, it should be rolled back. ------------------------------------------------------------------------ [2007-04-05 01:28:11] yohgaki at ohgaki dot net > And that's something I would call expected, because "rollback on > shutdown" is much safer than "commit on shutdown". As I wrote, under normal condition, current code(commit on shutdown) does make more sense than rollback on shutdown because PostgreSQL supports async query. 'Rollback on shutdown' is like 'Don't flush buffer before closing file'. It does not acceptable for most people. (And more efficient if it finish pending query at shutdown, too. If you are curious, take some simple benchmarks) However, under shared environment, it is not acceptable to consume all connection by COPY FROM SDTIN. It is better to have a way to avoid such action. There are 2 options: 1) Leave it alone (and make DoS possible under shared environment) 2) Give administrators a option that cancel current and pending async query. I prefer first option. I'll ask PostgreSQL developer if it's possible to have GRANT option for COPY in the future. ------------------------------------------------------------------------ [2007-03-09 10:11:12] tony2...@php.net >By calling PQcanel() before clean up resource, all async query which >is not finished yet will be discarded instead of finishing its query. And that's something I would call expected, because "rollback on shutdown" is much safer than "commit on shutdown". >I'll add new ini option that enables PQcancel() in >list_entry_destructor. Any >comments? More INI options? No, thanks. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=40544 -- Edit this bug report at https://bugs.php.net/bug.php?id=40544&edit=1