alexander
2020-1-30 12:36:52

@alexander has joined the channel


greg
2020-1-30 15:43:00

@mflatt @robby I am seeing a problem where drracket/check-syntax show-content returns bad pathnames in syncheck:add-jump-to-definition items. This doesn’t seem to happen in DrRacket itself, just via show-content. I’ve spent some hours trying to figure it out myself, but I’m stumped. A short write-up: https://gist.github.com/greghendershott/5dd59c00f8daa2ce0987ad343244489e


greg
2020-1-30 15:46:48

The TL;DR seems to be that somehow a #<module-path-index:"b.rkt" + '\|expanded module\|> results, and becomes a #<resolved-module-path:"/tmp/a.rkt/b.rkt">.


greg
2020-1-30 15:58:56

“oh ha ha, must be missing a current-load-relative-directory parameterization somewhere, this will be easy” …. hours later, “WAT”



mflatt
2020-1-30 17:10:26

I think you’re right that it’s about current-load-relative-directory. That’s set in “traverse.rkt” to the path passed in to make-traversal.


mflatt
2020-1-30 17:10:44

The argument to make-travseral appears to be a file path, not a directory, in “check-syntax.rkt”.


greg
2020-1-30 17:14:22

I don’t think that’s it. I had tried adjusting that to be path-only, but same result.


greg
2020-1-30 17:15:40

I will double-check, though.


greg
2020-1-30 17:16:51

I had a run where my hacky “trace” showed current-load-relative-directory to be simply "/tmp/", and I was still getting that “unusual” (to me) #<module-path-index:"b.rkt" + '\|expanded module\|> (but maybe that is a red herring) and the wrong "/tmp/a.rkt/b.rkt".


leif
2020-1-30 19:25:27

@mflatt and @robby DrRacket seems to have a memory leak when closing files.


leif
2020-1-30 19:25:59

Namely, not only does it not return memory to the OS when you close a file, but it also doesn’t seem tore-use that memory when a new tab is opened.


popa.bogdanp
2020-1-30 20:40:40

I am trying to use racket/sandbox ’s make-evaluator within an application distributed with raco exe , but I’m having trouble getting the lang (racket in this case) embedded in such a way that it works with make-evaluator . I’m currently doing something like:

(define-runtime-module-path-index the-lang 'racket) (make-evaluator (resolved-module-path-name (module-path-index-resolve the-lang))) But this fails when run from an executable generated with raco exe with:

make-evaluator: bad language spec: '#%embedded:racket/main:


popa.bogdanp
2020-1-30 20:42:32

I’ve tried other things such as using passing ++named-lib '' racket (i.e. a named lib with an empty prefix) and a plain ++lang racket to raco exe , but both approaches fail. Is there something I’m missing or is this a bug in make-evaluator ?


robby
2020-1-30 20:45:39

I’m not able to reproduce the leak.


robby
2020-1-30 20:46:23

I opened a file, gc’d to a fixed point, opened another file, gc’d to a fixed point, closed the second file, and gc’d and it didn’t go down, but when I opened and closed a third file, things went back down to the original fixed point (actually below it).


robby
2020-1-30 20:46:32

(Also, there is a test on drdr for this)


leif
2020-1-30 22:14:42

@robby It seems to be a problem even if you close and reopen the same file.


leif
2020-1-30 22:15:41

Like, DrRacket’s memory usage slowly climbed from 600 MB to 1.2 GB as I closed and reopened a file.


leif
2020-1-30 22:15:59

I’ll see if I can find a nice way to record it for you.


robby
2020-1-31 00:02:25

what if you click on the gc icon .a lot, @leif ?


robby
2020-1-31 00:02:34

Does that eventually make things go back down?


leif
2020-1-31 00:57:24

@robby Sadly nope


leif
2020-1-31 00:57:32

I have a recording now, uploading it.


robby
2020-1-31 01:02:05

any advice on how to watch this video?


robby
2020-1-31 01:02:15

oh, it disappeared


leif
2020-1-31 01:02:29

Ya, sorry, I expected slack to stream it. Reuploading it to youtube.


leif
2020-1-31 01:13:46

@robby Okay, here it is:



robby
2020-1-31 01:18:01

I can’t claim to understand the relationship between the number that racket reports and the number that the OS reports but the numbers that racket reports don’t look like a leak to me


robby
2020-1-31 01:19:29

In particular at the 1:01 mark in the video you’re back down to 511MB


leif
2020-1-31 01:19:30

Ya. that makes me inclined to think that if anything, its a racket VM bug, rather than a DrRacket specific one.


leif
2020-1-31 01:19:32

Maybe.


robby
2020-1-31 01:19:44

I don’t see you clicking onthe gc icon much


leif
2020-1-31 01:19:47

Right, well according to DrRacket.


leif
2020-1-31 01:19:55

I only do it at the end.


robby
2020-1-31 01:19:56

I think there was only one major collection in the video?


robby
2020-1-31 01:20:05

Yeah, you need those if you want memory to go back to the OS


robby
2020-1-31 01:20:12

You need to do it more.


robby
2020-1-31 01:20:36

(Or maybe someone could tune the GC I suppose but it has been tuned a lot over the years.)


leif
2020-1-31 01:20:51

I mean, I clicked on it a lot at the end.


leif
2020-1-31 01:20:56

And it still didn’t go down.


leif
2020-1-31 01:21:07

(By that I mean what the OS reported, rather than what DrRacket claimed)


robby
2020-1-31 01:21:34

Maybe you have to click on the numbers


robby
2020-1-31 01:21:56

from 1:13 on when your mouse is over the gc icon, there is no gc actually happening


leif
2020-1-31 01:21:58

While I didn’t try that in this video, I have tried that before.


robby
2020-1-31 01:22:32

sorry, I don’t have anything more useful here :disappointed:


leif
2020-1-31 01:22:50

No worries. I’ll play with it more.


leif
2020-1-31 01:23:03

Thanks anyway. I appreciate the suggestions you’ve given me. :slightly_smiling_face:


mflatt
2020-1-31 01:27:28

There are so many pitfalls here.

The first one is that the result of resolved-module-path-name is not generally a module path: it’s a path (which does turn out to be a module path) or a symbol.

Another set of problems is related to the fact that make-evaluator creates a new namespace with a new module registry, so modules defined in the original registry need to be attached via sandbox-namespace-specs.

And then there are more issues with the configure-runtime submodule.

And there are issues with filesystem access, definitely for a dumb reason in the first case that I hit, but there may be more.

Long story short, when using raco exe ++lang racket, I can get this to work:

#lang racket/base (require racket/sandbox) (parameterize ([sandbox-namespace-specs (append (sandbox-namespace-specs) (list 'racket 'racket/runtime-config))]) (call-with-trusted-sandbox-configuration (lambda () (make-evaluator 'racket)))) Using call-with-trusted-sandbox-configuration to avoid the filesystem issue may well defeat the point for your purposes.


popa.bogdanp
2020-1-31 07:36:44

Thank you for digging into this! For now I’m going to distribute the app in source form, alongside a Racket install since that seems like the path of least resistance.