racket / drracket

DrRacket, IDE for Racket
http://www.racket-lang.org/
Other
444 stars 93 forks source link

Background expansion terminated abnormally (out of memory) #580

Closed sorawee closed 1 year ago

sorawee commented 1 year ago
#lang typed/racket

(struct S ([elem : (S Number -> Number)]) #:prefab)

(: get-val (-> S Number Number))
(define (get-val x y)
  y)

(S get-val)

fails with:

Background expansion terminated abnormally (out of memory)

Reported by user CalvinX on Discord.

rfindler commented 1 year ago

I added some code that woudl wait 10 seconds and then break the thread that's working and this is the stacktrace I get:

user break
  context...:
   /Users/robby/git/plt/racket/share/pkgs/typed-racket-lib/typed-racket/types/printer.rkt:69:0: has-name?
   .../match/compiler.rkt:548:40: f1805
   .../private/map.rkt:40:19: loop
   .../match/compiler.rkt:548:40: f1778
   .../private/map.rkt:40:19: loop
   /Users/robby/git/plt/racket/share/pkgs/typed-racket-lib/typed-racket/types/printer.rkt:354:0: arr->sexp
   .../private/map.rkt:40:19: loop
   .../match/compiler.rkt:548:40: f1778
   .../private/map.rkt:40:19: loop
   /Users/robby/git/plt/racket/share/pkgs/typed-racket-lib/typed-racket/types/printer.rkt:354:0: arr->sexp
   .../private/map.rkt:40:19: loop
   .../match/compiler.rkt:548:40: f1778
   .../private/map.rkt:40:19: loop
   /Users/robby/git/plt/racket/share/pkgs/typed-racket-lib/typed-racket/types/printer.rkt:354:0: arr->sexp
   .../private/map.rkt:40:19: loop
   .../match/compiler.rkt:548:40: f1778
   ...

Does this ring any bells @samth ?

samth commented 1 year ago

Yeah that looks like an infinite loop in the printer.

samth commented 1 year ago

Most likely printing a recursive #:prefab type tries to print the type again.

samth commented 1 year ago

Changing the last line to (S 1) causes expansion (not just background expansion) to fail to terminate. I think the original program is diverging when trying to produce tooltips.