GNU bug report logs - #23404
Infinite recursion in GOOPS in Guile 2.2

Previous Next

Package: guile;

Reported by: Christopher Allan Webber <cwebber <at> dustycloud.org>

Date: Sat, 30 Apr 2016 00:29:01 UTC

Severity: normal

Done: Andy Wingo <wingo <at> pobox.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23404 in the body.
You can then email your comments to 23404 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#23404; Package guile. (Sat, 30 Apr 2016 00:29:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christopher Allan Webber <cwebber <at> dustycloud.org>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Sat, 30 Apr 2016 00:29:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christopher Allan Webber <cwebber <at> dustycloud.org>
To: bug-guile <at> gnu.org
Subject: Infinite recursion in GOOPS in Guile 2.2
Date: Fri, 29 Apr 2016 19:27:56 -0500
Heya all,

So I've been building something with GOOPS, and I decided to try it out
with Guile 2.2.  Unfortunately, I hit a pretty nasty bug.  You can try
it yourself... the code is pretty short:

  (use-modules (oop goops)
               (srfi srfi-9))
  (define-class <some-class> ())
  (define-method (time-to-break (some-class <some-class>) not-a-class)
    (display "We're never going home are we?\n"))

  ;; And now, call it
  (time-to-break (make <some-class>) 1)

This will loop forever and *never* complete.  Why?

Turns out this is why, from goops.scm:

  (define (single-arity-cache-dispatch cache nargs cache-miss)
    (match cache
      (() cache-miss)
      (((typev . cmethod) . cache)
       (cond
        ((eqv? nargs (vector-length typev))
         (let ((cache-miss (single-arity-cache-dispatch cache nargs cache-miss)))

I'm not sure what was supposed to happen (presumably the cache was
supposed to be narrowed down somehow), but what happens here is that
single-arity-cache-dispatch keeps calling single-arity-cache-dispatch
forever.

scheme@(guile-user) [1]> ,bt
In oop/goops.scm:
   1437:41939 (cache-miss #<<hive> e8a1e0> #<<message> id: "5c787e65bbeb34b27ffd16eead286fc6:1" to: ("8394701db8…>)
   1486:41938 (memoize-effective-method! _ _ _)
  1466:131937 (recompute-generic-function-dispatch-procedure! #<<generic> hive-process-message (1)>)
  1452:161936 (compute-generic-function-dispatch-procedure _)
  1378:251935 (single-arity-cache-dispatch _ 2 _)
  1378:251934 (single-arity-cache-dispatch _ 2 _)
  1378:251933 (single-arity-cache-dispatch _ 2 _)
  1378:251932 (single-arity-cache-dispatch _ 2 _)
  1378:251931 (single-arity-cache-dispatch _ 2 _)
  1378:251930 (single-arity-cache-dispatch _ 2 _)
  1378:251929 (single-arity-cache-dispatch _ 2 _)
  1378:251928 (single-arity-cache-dispatch _ 2 _)
  1378:251927 (single-arity-cache-dispatch _ 2 _)
  1378:251926 (single-arity-cache-dispatch _ 2 _)
  1378:251925 (single-arity-cache-dispatch _ 2 _)
  1378:251924 (single-arity-cache-dispatch _ 2 _)
  ... etc ...

(g?)Oops!

 - Chris




Information forwarded to bug-guile <at> gnu.org:
bug#23404; Package guile. (Sat, 30 Apr 2016 02:27:01 GMT) Full text and rfc822 format available.

Message #8 received at 23404 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Allan Webber <cwebber <at> dustycloud.org>
To: 23404 <at> debbugs.gnu.org
Subject: Re: Infinite recursion in GOOPS in Guile 2.2
Date: Fri, 29 Apr 2016 21:26:52 -0500
It looks like my example was incomplete.  It turns out loading and
passing in an srfi-9 record is critical to instantiating the bug.

Why?  I'm not sure...

  (use-modules (oop goops)
               (srfi srfi-9))
  (define-class <some-class> ())
  (define-record-type <some-record>
    (make-some-record foo)
    some-record?
    (foo some-record-foo))
  
  (define-method (time-to-break (some-class <some-class>) not-a-class)
    (display "We're never going home are we?\n"))
  
  ;; Now it'll break
  (time-to-break (make <some-class>) (make-some-record 1))




Information forwarded to bug-guile <at> gnu.org:
bug#23404; Package guile. (Sat, 30 Apr 2016 02:28:02 GMT) Full text and rfc822 format available.

Message #11 received at 23404 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Allan Webber <cwebber <at> dustycloud.org>
To: 23404 <at> debbugs.gnu.org
Subject: Re: Infinite recursion in GOOPS in Guile 2.2
Date: Fri, 29 Apr 2016 21:27:20 -0500
It looks like my example was incomplete.  It turns out loading and
passing in an srfi-9 record is critical to instantiating the bug.

Why?  I'm not sure...

  (use-modules (oop goops)
               (srfi srfi-9))
  (define-class <some-class> ())
  (define-record-type <some-record>
    (make-some-record foo)
    some-record?
    (foo some-record-foo))
  
  (define-method (time-to-break (some-class <some-class>) not-a-class)
    (display "We're never going home are we?\n"))
  
  ;; Now it'll break
  (time-to-break (make <some-class>) (make-some-record 1))




Reply sent to Andy Wingo <wingo <at> pobox.com>:
You have taken responsibility. (Tue, 28 Feb 2017 15:13:02 GMT) Full text and rfc822 format available.

Notification sent to Christopher Allan Webber <cwebber <at> dustycloud.org>:
bug acknowledged by developer. (Tue, 28 Feb 2017 15:13:02 GMT) Full text and rfc822 format available.

Message #16 received at 23404-done <at> debbugs.gnu.org (full text, mbox):

From: Andy Wingo <wingo <at> pobox.com>
To: Christopher Allan Webber <cwebber <at> dustycloud.org>
Cc: 23404-done <at> debbugs.gnu.org
Subject: Re: bug#23404: Infinite recursion in GOOPS in Guile 2.2
Date: Tue, 28 Feb 2017 16:12:46 +0100
On Sat 30 Apr 2016 04:27, Christopher Allan Webber <cwebber <at> dustycloud.org> writes:

> It looks like my example was incomplete.  It turns out loading and
> passing in an srfi-9 record is critical to instantiating the bug.
>
> Why?  I'm not sure...
>
>   (use-modules (oop goops)
>                (srfi srfi-9))
>   (define-class <some-class> ())
>   (define-record-type <some-record>
>     (make-some-record foo)
>     some-record?
>     (foo some-record-foo))
>   
>   (define-method (time-to-break (some-class <some-class>) not-a-class)
>     (display "We're never going home are we?\n"))
>   
>   ;; Now it'll break
>   (time-to-break (make <some-class>) (make-some-record 1))

This appears to be fixed, somehow (?).  Please reopen if you can still
produce the bug.

Andy




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 29 Mar 2017 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 84 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.