[racket-dev] Contract violation from custodian shutdown

From: Neil Toronto (neil.toronto at gmail.com)
Date: Mon Dec 10 13:41:58 EST 2012

Randomly. It didn't happen often... maybe 1 in 15 times? I think you 
could open and run this program in a tab and then immediately close it:

#lang racket
(require math/bigfloat)

Do that a lot, and you might see it. :/ You'd have to reenable the 
custodian shutdown callback.

On 12/10/2012 08:57 AM, Matthew Flatt wrote:
> It's hard to say where the bug is, but there may be some problem in the
> implementation of custodians of `register-custodian-shutdown'. Is it
> repeatable?
>
> At Thu, 06 Dec 2012 16:48:37 -0700, Neil Toronto wrote:
>> I just got this message on my console, I think after closing a tab,
>> which coincided with DrRacket hanging:
>>
>>
>> eventspace-shutdown?: contract violation
>>     expected: eventspace?
>>     given: #<procedure:mpfr_free_cache>
>>     context...:
>>      /home/neil/plt/collects/mred/private/wx/common/queue.rkt:201:0:
>> shutdown-eventspace!
>>
>>
>> It's obviously because of this code, which is near the top of
>> "math/private/bigfloat/mpfr.rkt":
>>
>>
>> (define mpfr-free-cache (get-mpfr-fun 'mpfr_free_cache (_fun -> _void)))
>>
>> (define mpfr-shutdown
>>     (register-custodian-shutdown mpfr-free-cache (λ (free) (free))))
>>
>>
>> Did I misunderstand something, or is this someone else's bug?
>>
>> Neil ⊥
>> _________________________
>>    Racket Developers list:
>>    http://lists.racket-lang.org/dev


Posted on the dev mailing list.