Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #171755

Re: How to forcibly abort a command in a terminal window?

From Henrique de Moraes Holschuh <hmh@debian.org>
Newsgroups linux.debian.user
Subject Re: How to forcibly abort a command in a terminal window?
Date 2016-09-05 14:30 +0200
Message-ID <se1ce-3Hh-21@gated-at.bofh.it> (permalink)
References <se0zv-3bq-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, 05 Sep 2016, Richard Owlett wrote:
> I realized I had miss-specified options. As data was multiple GB and target
> was a USB connected flash drive I wished an immediate termination.

Usually there is no clean way to do this, and you have to wait for the
process to notice the signal, and abort.

> It seems there should be a better option?

There is none, at least for "cp" and just about everything else that
does normal writes (i.e. not direct I/O bypassing the kernel page
cache).

Maybe doing direct I/O using "dd o=direct" with a suitable (not too big)
buffer size would work differently, but I am not sure about that at all.

Anyway, from what you described, a lot of data to write was already
submitted by "cp" to the kernel, and the "cp" process would be in "D"
(uninterruptible sleep) state because it accumulated too many dirty
pages (pending writes) already and was still trying to queue up more
writes.

Eventually, the kernel would have flushed enough data to the device and
would decide to waken "cp" up to get more data to write, at which point
"cp" would notice the SIGINT from ^C, and abort.  The kernel would
continue to flush the remaining data that had already been submitted for
writing, though, so device writes would not immediately stop.

-- 
  Henrique Holschuh

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to forcibly abort a command in a terminal window? Richard Owlett <rowlett@cloud85.net> - 2016-09-05 13:50 +0200
  Re: How to forcibly abort a command in a terminal window? Henrique de Moraes Holschuh <hmh@debian.org> - 2016-09-05 14:30 +0200
    Re: How to forcibly abort a command in a terminal window? Richard Owlett <rowlett@cloud85.net> - 2016-09-05 15:20 +0200
      Re: How to forcibly abort a command in a terminal window? Jonathan Dowland <jmtd@debian.org> - 2016-09-05 15:40 +0200
        Re: How to forcibly abort a command in a terminal window? Richard Owlett <rowlett@cloud85.net> - 2016-09-05 16:10 +0200
          Re: How to forcibly abort a command in a terminal window? Charlie Kravetz <cjk@teamcharliesangels.com> - 2016-09-05 17:10 +0200
            Re: How to forcibly abort a command in a terminal window? Nicolas George <george@nsup.org> - 2016-09-05 17:20 +0200
              Re: How to forcibly abort a command in a terminal window? Dutch Ingraham <stoa@gmx.us> - 2016-09-05 18:20 +0200
                Re: How to forcibly abort a command in a terminal window? Nicolas George <george@nsup.org> - 2016-09-05 18:40 +0200
              Re: How to forcibly abort a command in a terminal window? Charlie Kravetz <cjk@teamcharliesangels.com> - 2016-09-05 18:30 +0200
                Re: How to forcibly abort a command in a terminal window? Vincent Lefevre <vincent@vinc17.net> - 2016-09-05 21:40 +0200

csiph-web