a little bug

193 views
Skip to first unread message

jon stenerson

unread,
Feb 4, 2016, 11:30:28 PM2/4/16
to racket-users@googlegroups.com List

#lang racket
(let ((x 1))
(letrec-syntax ((m (lambda (t) (syntax (m)))))
(m)))

When I run this in DrRacket 6.3 on Win 10 it starts looping. I hit the
stop button. The interaction window says "user break" and is ready for
another command.

However, the windows task manager shows DrRacket being very active and
eating more and more memory. After a minute DrRacket crashes. I guess
the bug is that the stop button doesn't stop the expander?

Jon

Robby Findler

unread,
Feb 5, 2016, 8:01:40 AM2/5/16
to jon stenerson, racket-users@googlegroups.com List
When I run this, I see a message at the bottom of the DrRacket window (in red):

Background expansion terminated abnormally (out of memory)

do you see this message?

Robby
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Anthony Carrico

unread,
Feb 5, 2016, 8:29:51 AM2/5/16
to racket...@googlegroups.com
On 02/05/2016 08:01 AM, Robby Findler wrote:
> When I run this, I see a message at the bottom of the DrRacket window (in red):
>
> Background expansion terminated abnormally (out of memory)
>
> do you see this message?

I tried too, and it stops fine with the same message as Robby. No
phantom CPU usage apparent.

However, I did have a run away DrRacket recently that didn't respond to
stop and took a few minutes to kill because my UI was extremely sluggish
(partially because X11 and/or the window manager sucks, and my CPU
probably throttled, but still...). I don't have any good data for you
about the circumstances of the issue though.

--
Anthony Carrico

Pierpaolo Bernardi

unread,
Feb 5, 2016, 8:41:57 AM2/5/16
to Anthony Carrico, Racket-Users List
On my system it behaves almost exactly as described by Jon (6.3, windows).

The one difference is that DrRacket hasn't crashed yet, but the Task
manager reports one processor at 100% and memory use slowly growing.
Currently is at 7.5 GB.

Robby Findler

unread,
Feb 5, 2016, 8:55:59 AM2/5/16
to Pierpaolo Bernardi, Anthony Carrico, Racket-Users List
It took a while for mine for the custodian limit to be reached and for
the expansion to run out of memory. It may be that the threshhold for
the memory use is too high on some systems. Maybe the right thing is
to set the default a bit lower?

Jon: if you open the "Racket" menu you should see a "Limit Memory..."
menu item. How does DrRacket do if you change the number in there to
256 and then paste the program into the definitions window? Do you see
the red message at the bottom of the screen or does DrRacket still run
out of memory?

Anthony: I don' thave a good solution for you, but I find that the
menu key short cut (control-k for you?) for killing is more likely to
get thru, because it requires a lot less event handling than the
others.

Robby

jon stenerson

unread,
Feb 5, 2016, 11:39:38 AM2/5/16
to racket...@googlegroups.com
Setting the limit lower helped. Thanks. I did not see that message about
Background Expansion Terminated before. Now I do.

Jon

jon stenerson

unread,
Feb 5, 2016, 11:54:23 AM2/5/16
to racket...@googlegroups.com
Actually you don't even have to run the program. With memory limit set
to 1024, just open a file containing the expression and wait. After a
minute or two DrRacket puts up a MSVC runtime error dialog.

Robby Findler

unread,
Feb 5, 2016, 3:55:20 PM2/5/16
to jon stenerson, racket-users@googlegroups.com List
In general, DrRacket does not promise to avoid this situation. Let me
explain a little bit. This program is effectively equivalent to this
one:

#lang racket/base
(define (run l)
(run (cons 'x l)))
(run '())

(but running at compile time, which is why things happen
automatically, but lets leave that aside for now).

So when you run that program, DrRacket is asking the operating system
for all of its memory. At some point, the operating system says
"sorry, no, we're out of memory" and since the program running inside
DrRacket doesn't really care that we're out of memory, the operating
system responds with "die!". And so DrRacket dies.

There are two ways we try to do better. First: we can set limits on
the memory. But if the limit is set to be higher than the amount of
memory available on the machine, then it is as if the memory limit
isn't set. Also worth noting at this point: the way that DrRacket's
counting of "how much memory" is only loosely related to the way that
your machine's vendor or the OS counts. There are some constant
factors of difference there that depend on things like how the garbage
collector is configured and how many other programs are running on
your system and what they are doing (like the OS itself likes to have
some of the memory and it (quite reasonably) doesn't want to share
that memory).

The second way is that the OS will sometimes say "you are about to
cause me to exhaust all of the system's memory and if you do that, I
will kill you" at which point the GC inside Racket responds with
"okay, I'll just die first". The main advantage of this is that you
get an error message saying "out of memory" from Racket instead of an
error message saying "I killed your program" from the OS (which is the
message you're getting). It turns out to be remarkably difficult to
get this error message to work in all situations. We're better than we
used to be at it, but at some level, the best we can do in that case
is really just to change the text of the error message. When we're out
of memory like that, it's very very hard to recover if the limits are
not set up ahead of time (i.e. back to the previous paragraph).

I hope this clears up the issue somewhat.

In the meantime, I suggest you lower the memory limit for your machine.

Robby

jon stenerson

unread,
Feb 5, 2016, 4:53:40 PM2/5/16
to racket...@googlegroups.com
Thanks for the explanation. I appreciate it.

Robby Findler

unread,
Feb 5, 2016, 5:45:00 PM2/5/16
to jon stenerson, racket-users@googlegroups.com List
Sorry we can't do better. And it is really amazing how I actually
think so anthropomorphically about these things. :) That really was a
literal brain dump.

Robby

jon stenerson

unread,
Feb 5, 2016, 7:19:46 PM2/5/16
to racket...@googlegroups.com
lol. Don't be sorry. Speaking of anthropomorphization, I really love Dr
Racket and hope I didn't hurt his feelings (Or is Dr Racket a she?). I
employ his services whenever I can. I don't mean to be a whiner; he
deserves better than that!

Jon

Hendrik Boom

unread,
Feb 28, 2020, 6:45:54 AM2/28/20
to Racket Users

When Racket detects the out-of-memory condition during "background processing", it would be useful i the out-of-memory message were to point out which particular piece of source text it was having trouble with.  Just the line number where the expression started that the REPL was having trouble with would be a huge help.

And by the way, if Dr. Racket were to be a she, she would be addressed in Quebec as Dre. Racket.
>>>>>>>> an email to racket...@googlegroups.com.
>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "Racket Users" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>>>> an email to racket...@googlegroups.com.
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google Groups
>>>> "Racket Users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send an
>>>> For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an

Robby Findler

unread,
Feb 28, 2020, 7:02:48 AM2/28/20
to Hendrik Boom, Racket Users
I agree that would be great. In the meantime, the Run button does a better job with error reporting in various ways, including this one so hopefully you can try that?

Robby

To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/db96d3e9-be16-43f4-a9fa-9e008e3748e8%40googlegroups.com.

Hendrik Boom

unread,
Feb 28, 2020, 7:31:30 AM2/28/20
to Racket Users
On Fri, Feb 28, 2020 at 06:02:31AM -0600, Robby Findler wrote:
> I agree that would be great. In the meantime, the Run button does a better
> job with error reporting in various ways, including this one so hopefully
> you can try that?

That's what I was using. There was a popup message that wasn't any more
informative.
It says:

- The evaluation thread is no longer running, so
no evaluation can take place until the next
execution.

The program ran out of memory.
[V]Show thid dialog ext time
[Increase memory limit to 256 megabytes] [OK]

I'm mentioning this to indicate a way the drracket uer-interface can be
improved, especially for beginners.

I'm not asking Racket maintainers to step in and debug my code.

(Further analysis (by deleting code until there was almost nothing left)
indicates it crashed during processing the #lang line at the start.
I have started private correspondence with the language author.)

-- hendrik
> > <https://groups.google.com/d/msgid/racket-users/db96d3e9-be16-43f4-a9fa-9e008e3748e8%40googlegroups.com?utm_medium=email&utm_source=footer>
> > .
> >
>
> --
> You received this message because you are subscribed to the Google Groups "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAL3TdONV00LJ8yUMXyVK4SbzFr8qgGTfEwqcLPTz-1ocUkzgsw%40mail.gmail.com.

Robby Findler

unread,
Feb 28, 2020, 8:11:21 AM2/28/20
to Racket Users
Oh, sorry-- I misunderstood.

In v7.5, there will be, in some cases, a source location after you
dismiss that dialog. In the pre-release builds, that's been improved
somewhat and source location information is more reliably available.
That said, there are limitations and it isn't always available.

Thanks for using DrR!

Robby
> To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/20200228123121.osgwqasvcww2jxoy%40topoi.pooq.com.

Hendrik Boom

unread,
Feb 28, 2020, 12:39:16 PM2/28/20
to Racket Users
On Fri, Feb 28, 2020 at 07:11:02AM -0600, Robby Findler wrote:
> Oh, sorry-- I misunderstood.
>
> In v7.5, there will be, in some cases, a source location after you
> dismiss that dialog. In the pre-release builds, that's been improved
> somewhat and source location information is more reliably available.

Excellent.

> That said, there are limitations and it isn't always available.

Of course. If the entire process gets shut down because of memory
overrun there isn't much left to report on.

>
> Thanks for using DrR!

It's the easiest way to use Racket.
> To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAL3TdOPuwNNL0QYOcZUiiid5xeaSq2eNsuuK35VHy60oScjBrw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages