Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Yq6MV-0007mr-4R for pgsql-bugs@arkaria.postgresql.org; Wed, 06 May 2015 20:56:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Yq6MU-0002Bo-EW for pgsql-bugs@arkaria.postgresql.org; Wed, 06 May 2015 20:56:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Yq6MT-0002Bf-DF for pgsql-bugs@postgresql.org; Wed, 06 May 2015 20:56:09 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1Yq6MP-0002CU-D5 for pgsql-bugs@postgresql.org; Wed, 06 May 2015 20:56:08 +0000 MIME-Version: 1.0 Subject: BUG #13246: Failure to pg_terminate_backend To: pgsql-bugs@postgresql.org From: daniel@heroku.com Date: Wed, 06 May 2015 20:55:30 +0000 Message-ID: <20150506205530.1095.52171@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.2 (-) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 13246 Logged by: Daniel Farina Email address: daniel@heroku.com PostgreSQL version: 9.4.1 Operating system: Ubuntu 12.04.5 Description: Postgres gets stuck in this loop and, not checking for signals, will not respect the SIGTERM from pg_terminate_backend. This seems like a variant of other problems I've seen with pg_terminate_backend not being able to function when one is stuck in Openssl, though it seems that in recent versions of Postgres that PG provides its own low level I/O functions (e.g. my_sock_write) and maybe this is fixable? I ran strace too, butgot the ERESTARTSYS return code which appears to be possibly a side effect of strace itself. Information dump follows: $ strace -p PID sendto(10, "REDACTED-BUT-IS-ONE-STRING"..., 1092, 0, NULL, 0) = ? ERESTARTSYS (To be restarted) --- SIGTERM (Terminated) @ 0 (0) --- rt_sigreturn(0x7fe41f56bcdc) = 44 sendto(10, "REDACTED-BUT-IS-ONE-STRING"..., 1092, 0, NULL, 0) = ? ERESTARTSYS (To be restarted) --- SIGTERM (Terminated) @ 0 (0) --- rt_sigreturn(0x7fe41f56bcdc) = 44 sendto(10, "REDACTED-BUT-IS-ONE-STRING"..., 1092, 0, NULL, 0) = ? ERESTARTSYS (To be restarted) --- SIGTERM (Terminated) @ 0 (0) --- rt_sigreturn(0x7fe41f56bcdc) = 44 sendto(10, "REDACTED-BUT-IS-ONE-STRING"..., 1092, 0, NULL, 0) = ? ERESTARTSYS (To be restarted) --- SIGTERM (Terminated) @ 0 (0) --- rt_sigreturn(0x7fe41f56bcdc) = 44 sendto(10, "REDACTED-BUT-IS-ONE-STRING"..., 1092, 0, NULL, 0) = ? ERESTARTSYS (To be restarted) --- SIGTERM (Terminated) @ 0 (0) --- rt_sigreturn(0x7fe41f56bcdc) = 44 sendto(10, "REDACTED-BUT-IS-ONE-STRING"..., 1092, 0, NULL, 0) = ? ERESTARTSYS (To be restarted) --- SIGTERM (Terminated) @ 0 (0) --- $ gdb -p PID (gdb) bt #0 0x00007fe42be95462 in send () from /lib/x86_64-linux-gnu/libc.so.6 #1 0x00007fe42dcbc487 in my_sock_write (h=0x7fe42efa5eb0, buf=, size=) at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/libpq/be-secure.c:516 #2 0x00007fe42cdd4667 in BIO_write () from /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 #3 0x00007fe42d0f0260 in ?? () from /lib/x86_64-linux-gnu/libssl.so.1.0.0 #4 0x00007fe42d0f0984 in ?? () from /lib/x86_64-linux-gnu/libssl.so.1.0.0 #5 0x00007fe42dcbd1d5 in secure_write (port=0x7fe42efa51b0, ptr=0x7fe42efaad90, len=) at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/libpq/be-secure.c:391 #6 0x00007fe42dcc7c06 in internal_flush () at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/libpq/pqcomm.c:1324 #7 0x00007fe42dcc7d77 in internal_putbytes (s=0x7fe42f0652cd "REDACTED", len=4) at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/libpq/pqcomm.c:1270 #8 0x00007fe42dcc8f2c in pq_putmessage (msgtype=100 'd', s=0x7fe42f065280 "", len=) at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/libpq/pqcomm.c:1467 #9 0x00007fe42dc3a82d in CopySendEndOfRow (cstate=0x7fe42ef78d20) at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/commands/copy.c:546 #10 0x00007fe42dc3aa88 in CopyOneRowTo (cstate=0x7fe42ef78d20, tupleOid=, values=0x7fe42f05c990, nulls=) at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/commands/copy.c:1939 #11 0x00007fe42dc3af55 in copy_dest_receive (slot=0x7fe42f05ac20, self=0x7fe42f049fb0) at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/commands/copy.c:4310 #12 0x00007fe42dc9182a in ExecutePlan (dest=0x7fe42f049fb0, direction=, numberTuples=0, sendTuples=1 '\001', operation=CMD_SELECT, planstate=0x7fe42f05ad70, estate=0x7fe42f05aa30) at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/executor/execMain.c:1511 #13 standard_ExecutorRun (queryDesc=0x7fe42f047850, direction=, count=0) at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/executor/execMain.c:319 #14 0x00007fe4214a2d75 in pgss_ExecutorRun (queryDesc=0x7fe42f047850, direction=ForwardScanDirection, count=0) at /tmp/buildd/postgresql-9.4-9.4.1/build/../contrib/pg_stat_statements/pg_stat_statements.c:875 #15 0x00007fe42dc3b3c9 in CopyTo (cstate=0x7fe42ef78d20) at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/commands/copy.c:1836 #16 DoCopyTo (cstate=0x7fe42ef78d20) at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/commands/copy.c:1659 #17 0x00007fe42dc3fc9d in DoCopy (stmt=, queryString=, processed=0x7ffc2581b9f8) at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/commands/copy.c:878 #18 0x00007fe42dd8fa8f in standard_ProcessUtility (parsetree=0x7fe42effd760, queryString=0x7fe42effbae0 "set work_mem = '1GB'; COPY (REDACTED) TO STDOUT BINARY", context=, params=0x0, dest=, completionTag=0x7ffc2581c140 "") at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/tcop/utility.c:525 #19 0x00007fe4214a5813 in pgss_ProcessUtility (parsetree=0x7fe42effd760, queryString=0x7fe42effbae0 "set work_mem = '1GB'; COPY (REDACTED) TO STDOUT BINARY", context=PROCESS_UTILITY_QUERY, params=0x0, dest=0x7fe42f02c440, completionTag=0x7ffc2581c140 "") at /tmp/buildd/postgresql-9.4-9.4.1/build/../contrib/pg_stat_statements/pg_stat_statements.c:984 #20 0x00007fe2115cd2ca in extwlist_ProcessUtility (parsetree=0x7fe42effd760, queryString=0x7fe42effbae0 "set work_mem = '1GB'; COPY (REDACTED) TO STDOUT BINARY", context=PROCESS_UTILITY_QUERY, params=0x0, dest=0x7fe42f02c440, completionTag=0x7ffc2581c140 "") at pgextwlist.c:346 #21 0x00007fe42dd8c683 in PortalRunUtility (portal=0x7fe42f02a430, utilityStmt=0x7fe42effd760, isTopLevel=0 '\000', dest=0x7fe42f02c440, completionTag=0x7ffc2581c140 "") at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/tcop/pquery.c:1187 #22 0x00007fe42dd8d2c6 in PortalRunMulti (portal=0x7fe42f02a430, isTopLevel=0 '\000', dest=0x7fe42f02c440, altdest=0x7fe42f02c440, completionTag=0x7ffc2581c140 "") at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/tcop/pquery.c:1318 #23 0x00007fe42dd8df5d in PortalRun (portal=0x7fe42f02a430, count=9223372036854775807, isTopLevel=0 '\000', dest=0x7fe42f02c440, altdest=0x7fe42f02c440, completionTag=0x7ffc2581c140 "") at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/tcop/pquery.c:816 #24 0x00007fe42dd8a09c in exec_simple_query ( query_string=0x7fe42effbae0 "set work_mem = '1GB'; COPY (REDACTED) TO STDOUT BINARY") at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/tcop/postgres.c:1072 #25 PostgresMain (argc=, argv=, dbname=0x7fe42ef5f288 "REDACTED", username=) at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/tcop/postgres.c:4074 #26 0x00007fe42dd3574b in BackendRun (port=0x7fe42efa51b0) at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/postmaster/postmaster.c:4155 #27 BackendStartup (port=0x7fe42efa51b0) at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/postmaster/postmaster.c:3829 #28 ServerLoop () at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/postmaster/postmaster.c:1597 #29 PostmasterMain (argc=, argv=) at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/postmaster/postmaster.c:1244 #30 0x00007fe42db54a31 in main (argc=5, argv=0x7fe42ef5e3b0) at /tmp/buildd/postgresql-9.4-9.4.1/build/../src/backend/main/main.c:228 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs