pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: oktogen@mail.ru
To: pgsql-bugs@postgresql.org
Subject: BUG #13671: pg_terminate_backend(pid) does not work
Date: Fri, 09 Oct 2015 07:43:34 +0000
Message-ID: <20151009074334.1217.18732@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      13671
Logged by:          alex
Email address:      oktogen@mail.ru
PostgreSQL version: 9.4.5
Operating system:   ubuntu
Description:        

The command pg_terminate_backend(pid) does not terminate sql session
in case incorrect formed COPY command(without terminate-symbol)
Example
--SESSION #1
CREATE TABLE public.comments (
  user_id INTEGER NOT NULL,
  description TEXT NOT NULL,
  path public.ltree NOT NULL,
  CONSTRAINT comments_idx PRIMARY KEY(user_id, description, path)
)WITHOUT OIDS;

COPY comments (user_id, description, path) FROM stdin;
1	efbb974bcf5af8f2ba8f352225ecff63	0001
2	8dcdb42684773f413b40d63f5ef0722e	0001.0001.0001
--

--SESSION #2
-- Now SESSION # 1 can not be forced to complete the outside.
-- learn pid process which need  terminate
SELECT a.pid,
    a.usename,
    a.application_name,
    a.client_addr,
    clock_timestamp() - a.query_start AS duration,
    a.state,
    a.query,
    a.waiting
FROM pg_stat_activity a;

--attempt to finish the session with incorrect COPY command
SELECT pg_terminate_backend(6476) AS output;
--   output
-------------
-- TRUE
 
SELECT 
	a.pid,
  a.state,
  a.query
FROM pg_stat_activity a
WHERE a.pid = 6476;
-- output(failed attempt) 
+-----+--------+---------------------------------------------------------+
| pid | state  |                  query                                  |
+-----+--------+---------------------------------------------------------+
|6476 | active |  COPY comments (user_id, description, path) FROM stdin; |
+-----+--------+---------------------------------------------------------+



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (4+ messages)  latest in thread

Message-ID: <20151009074334.1217.18732@wrigleys.postgresql.org>
Permalink:  ../20151009074334.1217.18732@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20151009074334.1217.18732@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: oktogen@mail.ru
  Subject: Re: BUG #13671: pg_terminate_backend(pid) does not work
  In-Reply-To: <20151009074334.1217.18732@wrigleys.postgresql.org>
  References: <20151009074334.1217.18732@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox