unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* sigaction leak
@ 2004-04-01 22:07 Kevin Ryde
  2004-05-10 22:14 ` Marius Vollmer
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Ryde @ 2004-04-01 22:07 UTC (permalink / raw)


On my i386 debian, a program

	(while #t (sigaction SIGPIPE (sigaction SIGPIPE SIG_IGN)))

seems to make the guile process grow without bound, not very quickly,
but apparently inexorably.  Perhaps someone smarter than me can look
into where it might be going.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: sigaction leak
  2004-04-01 22:07 sigaction leak Kevin Ryde
@ 2004-05-10 22:14 ` Marius Vollmer
  2004-05-12  0:51   ` Kevin Ryde
  0 siblings, 1 reply; 3+ messages in thread
From: Marius Vollmer @ 2004-05-10 22:14 UTC (permalink / raw)


Kevin Ryde <user42@zip.com.au> writes:

> On my i386 debian, a program
>
> 	(while #t (sigaction SIGPIPE (sigaction SIGPIPE SIG_IGN)))
>
> seems to make the guile process grow without bound, not very quickly,
> but apparently inexorably.

Got it!  The code above uses sigaction incorrectly, it should be
something like

    (define (restore-sigaction num old)
      (sigaction num (car old) (cdr old)))

    (while #t (restore-sigaction SIGPIPE (sigaction SIGPIPE SIG_IGN)))

The 'leak' occurs because the outer sigaction stores a larger and
larger data structure as the handler of the signal.  That data
structure is not a valid handler, but sigaction doesn't reject it.

    guile> (define old (sigaction SIGPIPE SIG_IGN))
    guile> old
    (0 . 268435456)
    guile> (sigaction SIGPIPE old)
    (1 . 268435456)
    guile> (define old (sigaction SIGPIPE SIG_IGN))
    guile> old
    ((0 . 268435456) . 268435456)


I have fixed sigaction:

2004-05-11  Marius Vollmer  <mvo@zagadka.de>

	* scmsigs.c (scm_sigaction_for_thread): Validate that the handler
	is indeed a procedure when it isn't a number.


-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: sigaction leak
  2004-05-10 22:14 ` Marius Vollmer
@ 2004-05-12  0:51   ` Kevin Ryde
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Ryde @ 2004-05-12  0:51 UTC (permalink / raw)
  Cc: guile-devel

Marius Vollmer <mvo@zagadka.de> writes:
>
> The 'leak' occurs because the outer sigaction stores a larger and
> larger data structure as the handler of the signal.

Oops.

> 	* scmsigs.c (scm_sigaction_for_thread): Validate that the handler
> 	is indeed a procedure when it isn't a number.

That should keep people (cough) out of trouble. :)


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-05-12  0:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-01 22:07 sigaction leak Kevin Ryde
2004-05-10 22:14 ` Marius Vollmer
2004-05-12  0:51   ` Kevin Ryde

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 read-only IMAP folder(s) and NNTP newsgroup(s).