GNU bug report logs - #17466
unexpected bytevector contents with get-bytevector-n

Previous Next

Package: guile;

Reported by: J Kalbhenn <jkal <at> posteo.eu>

Date: Sun, 11 May 2014 16:51:01 UTC

Severity: normal

Merged with 17591

Done: ludo <at> gnu.org (Ludovic Courtès)

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 17466 in the body.
You can then email your comments to 17466 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#17466; Package guile. (Sun, 11 May 2014 16:51:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to J Kalbhenn <jkal <at> posteo.eu>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Sun, 11 May 2014 16:51:02 GMT) Full text and rfc822 format available.

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

From: J Kalbhenn <jkal <at> posteo.eu>
To: bug-guile <at> gnu.org
Subject: unexpected bytevector contents with get-bytevector-n
Date: Sun, 11 May 2014 13:00:23 +0200
concerning the following code example
--
(import (rnrs io ports) (ice-9 pretty-print))
(define (problem-part port) (pretty-print (get-bytevector-n port 4096)))

(let loop ((count 100))
  (if (> count 0)
    (begin (call-with-input-string "22222222222222222222" problem-part)
(loop (- count 1)))))
__

when i run it i get output with portions like this
--
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(50 50 50 50 50 50 50 50 16 224 240 0 0 0 0 0 50 50 50 50)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
--

and i would expect the bytevector to always be the same.

this first occurred to me in a more complicated scenario where:
  - the input port is a file-port
  - pretty-print was used at first and then display instead, but the
problem persisted with a much lower frequency

system info
  guile 2.0.11
  linux 3.14.2-1-ARCH x86_64




Merged 17466 17591. Request was from ludo <at> gnu.org (Ludovic Courtès) to control <at> debbugs.gnu.org. (Wed, 28 May 2014 15:25:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guile <at> gnu.org:
bug#17466; Package guile. (Wed, 28 May 2014 15:27:01 GMT) Full text and rfc822 format available.

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

From: ludo <at> gnu.org (Ludovic Courtès)
To: J Kalbhenn <jkal <at> posteo.eu>
Cc: 17466 <at> debbugs.gnu.org
Subject: Re: bug#17466: unexpected bytevector contents with get-bytevector-n
Date: Wed, 28 May 2014 17:26:47 +0200
Hello,

J Kalbhenn <jkal <at> posteo.eu> skribis:

> (import (rnrs io ports) (ice-9 pretty-print))
> (define (problem-part port) (pretty-print (get-bytevector-n port 4096)))
>
> (let loop ((count 100))
>   (if (> count 0)
>     (begin (call-with-input-string "22222222222222222222" problem-part)
> (loop (- count 1)))))
> __
>
> when i run it i get output with portions like this
> --
> #vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
> #vu8(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
> #vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
> #vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
> #vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
> #vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
> #vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
> #vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
> #vu8(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
> #vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
> #vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
> #vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
> #vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
> #vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
> #vu8(50 50 50 50 50 50 50 50 16 224 240 0 0 0 0 0 50 50 50 50)
> #vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
> --
>
> and i would expect the bytevector to always be the same.

Indeed.  I’ve been experiencing that in a more complex scenario too:
<http://bugs.gnu.org/17591>.

The guts of the problem seems to be GC_REALLOC.  I’m debugging it now
and your reduced test case will be helpful.

Ludo’.




Reply sent to ludo <at> gnu.org (Ludovic Courtès):
You have taken responsibility. (Wed, 28 May 2014 17:33:03 GMT) Full text and rfc822 format available.

Notification sent to J Kalbhenn <jkal <at> posteo.eu>:
bug acknowledged by developer. (Wed, 28 May 2014 17:33:03 GMT) Full text and rfc822 format available.

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

From: ludo <at> gnu.org (Ludovic Courtès)
To: J Kalbhenn <jkal <at> posteo.eu>
Cc: 17466-done <at> debbugs.gnu.org
Subject: Re: bug#17466: unexpected bytevector contents with get-bytevector-n
Date: Wed, 28 May 2014 19:32:22 +0200
This is fixed by commit 1baa215, which will be in Guile 2.0.12.

It turns out that when shrinking a bytevector, as happens before
‘get-bytevector-n’ returns, the pointer to the bytevector’s contents
would not be left pointing to the old bytevector.  When that old
bytevector was eventually reclaimed, anything could happen.

Thanks!

Ludo’.




Reply sent to ludo <at> gnu.org (Ludovic Courtès):
You have taken responsibility. (Wed, 28 May 2014 17:33:04 GMT) Full text and rfc822 format available.

Notification sent to ludo <at> gnu.org (Ludovic Courtès):
bug acknowledged by developer. (Wed, 28 May 2014 17:33:04 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 26 Jun 2014 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 306 days ago.

Previous Next


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