Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 0E86C3405C8 for ; Wed, 22 Feb 2012 11:12:29 -0400 (AST) Received: from mahout.postgresql.org ([98.129.198.123]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S0Drl-0006bu-Pf for pgsql-bugs@postgresql.org; Wed, 22 Feb 2012 15:12:28 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S0DrY-0007WO-Q0 for pgsql-bugs@postgresql.org; Wed, 22 Feb 2012 15:12:13 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1S0DrY-0007GQ-9O for pgsql-bugs@postgresql.org; Wed, 22 Feb 2012 15:12:12 +0000 Date: Wed, 22 Feb 2012 15:12:12 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #6482: Service terminates executing "With ... as ... UPDATE" query To: pgsql-bugs@postgresql.org From: dzolotarevskiy@gmail.com X-Pg-Spam-Score: -1.0 (-) X-Archive-Number: 201202/168 X-Sequence-Number: 32511 The following bug has been logged on the website: Bug reference: 6482 Logged by: Dmitriy Email address: dzolotarevskiy@gmail.com PostgreSQL version: 9.1.2 Operating system: Windows Server 2003 r2 32bit Description: = All Postgres processes terinates. In log you can find only = LOG: server process (PID ...) was terminated by exception OxC0000005. All queries works fine when there is only one session. When Sessions more then 20 it starts terminating with some probability. = On my production server it stops about 50 times per day. On my dev pc, with testing utility that uses 50 sessions at one time, it falls down in about 1 minute. Investigating problem i have found the "fatal" query and excluding part by part found out that new syntax produce that exception. To reproduce create 3 tables and execute my query in at least 20 simultaneous threads, each one should use separate session. Tables: user_task (pk id, fk user_proxy_id) user_proxy (pk id, fk proxy_last_id, date) proxy_last (pk id, last_used) Query: with mup as ( = UPDATE user_proxy = SET date =3D now() = WHERE id=3D (select user_proxy_id from user_task = where id=3D420 ) = returning proxy_last_id ) UPDATE proxy_last = SET last_used =3D now() = WHERE id=3D(select proxy_last_id = from mup); I have solved the problem rewriting query to old syntax.