Gnus development mailing list
 help / color / mirror / Atom feed
From: Simon Josefsson <jas@extundo.com>
Cc: David Coe <david@someotherplace.org>,
	bugs@gnus.org (The Gnus Bugfixing Girls + Boys),
	ding@gnus.org, 200823-forwarded@bugs.debian.org
Subject: Re: gnus: apparently kills external viewers too aggressively
Date: Wed, 27 Aug 2003 03:47:02 +0200	[thread overview]
Message-ID: <iluznhv3m95.fsf@latte.josefsson.org> (raw)
In-Reply-To: <86k790b8rp.fsf@someotherplace.org> (David Coe's message of "Tue, 26 Aug 2003 13:58:50 -0400")

David Coe <davidc@debian.org> writes:

> Simon Josefsson <jas@extundo.com> writes:
>
>> Can you strace or gdb display to see what signal it receives?  Or
>> perhaps simply start display on the command line and see if it leaves
>> a shared segment around if you SIGKILL or SIGTERM it?
>
> Yes, display does leave the segments allocated when it's SIGKILLed,
> and doesn't when it's SIGTERMed.  See Debian Bug#207379 against
> imagemagick ( http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=207379 ).  
> shmctl(2) does say that the creator of a segment *must* ensure
> that the segment is eventually destroyed, so this does look like a bug
> in imagemagick.
>
> I don't know whether it would be too much overhead for
> gnus to try SIGTERM before SIGKILL; I leave that up to you --
> as I'm sure you know, many programs don't (or can't) clean up after 
> themselves as well as they should when KILLed.

Makes sense, the patch below has been installed.  It tries to
interrupt the process in a loop with a echo area message, and when it
is dead, or you press C-g, it goes on and send it a final KILL and
remove the files.

Still, display seem to leave some memory around.  Starting display
allocates some buffers:

--- foo Wed Aug 27 03:40:41 2003
+++ bar Wed Aug 27 03:40:46 2003
@@ -37,6 +37,9 @@
 0x00000000 16515107   jas       777        7680000    0
 0x00000000 16547876   jas       777        262144     0
 0x00000000 16580645   jas       777        27648      0
+0x00000000 16810022   jas       777        7680000    2
+0x00000000 16842791   jas       777        262144     2
 0x00000000 16678952   jas       777        27648      0
 0x00000000 16777257   jas       777        27648      0
+0x00000000 16875562   jas       777        27648      2

Killing display cleanly removes some buffers, but not all:

--- foo Wed Aug 27 03:40:41 2003
+++ baz Wed Aug 27 03:40:51 2003
@@ -39,4 +39,5 @@
 0x00000000 16580645   jas       777        27648      0
 0x00000000 16678952   jas       777        27648      0
 0x00000000 16777257   jas       777        27648      0
+0x00000000 16875562   jas       777        27648      0

I'd say it is an ImageMagick bug.

2003-08-27  Simon Josefsson  <jas@extundo.com>

	* mm-decode.el (mm-remove-part): Try to kill external displayers
	cleanly first (if it refuses, C-g aborts loop and kill process
	unconditionally).  Also make sure process is dead before we remove
	the files it may be using.  Reported by David Coe
	<davidc@debian.org>.

Index: mm-decode.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/mm-decode.el,v
retrieving revision 6.92
retrieving revision 6.93
diff -u -p -r6.92 -r6.93
--- mm-decode.el	8 Jul 2003 15:28:27 -0000	6.92
+++ mm-decode.el	27 Aug 2003 01:49:26 -0000	6.93
@@ -844,9 +844,17 @@ external if displayed external."
 	  (funcall object))
 	 ;; Externally displayed part.
 	 ((consp object)
+	  (condition-case ()
+	      (while (get-buffer-process (cdr object))
+		(interrupt-process (get-buffer-process (cdr object)))
+		(message "Waiting for external displayer to die...")
+		(sit-for 1))
+	    (quit)
+	    (error))
+	  (ignore-errors (and (cdr object) (kill-buffer (cdr object))))
 	  (ignore-errors (delete-file (car object)))
-	  (ignore-errors (delete-directory (file-name-directory (car object))))
-	  (ignore-errors (and (cdr object) (kill-buffer (cdr object)))))
+	  (ignore-errors (delete-directory (file-name-directory
+					    (car object)))))
 	 ((bufferp object)
 	  (when (buffer-live-p object)
 	    (kill-buffer object)))))




  reply	other threads:[~2003-08-27  1:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-20 18:17 Manoj Srivastava
2003-08-20 23:25 ` Simon Josefsson
2003-08-26 17:58   ` David Coe
2003-08-27  1:47     ` Simon Josefsson [this message]
2003-08-27  4:55       ` David Coe
2003-08-27  6:03         ` Simon Josefsson

Reply instructions:

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

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

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=iluznhv3m95.fsf@latte.josefsson.org \
    --to=jas@extundo.com \
    --cc=200823-forwarded@bugs.debian.org \
    --cc=bugs@gnus.org \
    --cc=david@someotherplace.org \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).