[racket-dev] TR tests sometimes fail with a promise error

From: Asumu Takikawa (asumu at ccs.neu.edu)
Date: Thu May 2 22:14:44 EDT 2013

On 2013-04-04 10:33:25 -0700, Eric Dobson wrote:
> Sometimes TR tests fail with the error
>
> [...]
>
> How can this happen? Is the thread getting killed? Also since this
> error doesn't have blame information I don't know if this is an
> internal promise error or if TR is misusing the promise library.

I still don't know the cause of this problem, but the following smaller
example seems to exhibit the issue:

  #lang racket

  ;; Run this in collects/tests/typed-racket/optimizer

  (require unstable/open-place)

  (define (start-worker get-ch name)
    (open-place ch (let loop () (loop))))

  (define-values (enq-ch deq-ch) (place-channel))

  (define (start-workers)
    (for ([i 8])
      (start-worker deq-ch i)))

  (define (mk-suite dir)
    (define prms (for/list ([name (directory-list dir)]
                            ;; this line appears to be critical for some
                            ;; strange reason
                            #:when (regexp-match ".*rkt$" name))
                   (delay/thread 0)))
     (for/list ([p prms])
       (force p)))

  (define (optimization-tests) (mk-suite "tests"))

  ;;;

  (start-workers)

  (optimization-tests)

;;;

This produces a promise error on every third or fifth run or so for me.
Commenting out the #:when line makes it work, very oddly.

Since this error appears to be raised when the thread is killed
prematurely (e.g., (thread-kill (current-thread)) or via a continuation
abort), I would guess that the promise thread is somehow killed by a
strange interaction with places or something else.

Cheers,
Asumu

Posted on the dev mailing list.