@sorawee congrats on the POPL paper
“This paper presents the first formal framework for reasoning about the behavior of reusable symbolic evaluators.” “Rosette* replaces the semantic core of Rosette but keeps its optimized symbolic factory. Our results show that Rosette* matches the performance of Rosette across a wide range of benchmarks, while providing a cleaner interface that simplifies the implementation of client tools.”
I don’t understand it all, but that sounds impressive :slightly_smiling_face:
Ooh :eyes: I need to take a look. Read a lot about rosette during my ms
Thank you very much :smile:
congrats! which one is it?
@sorawee congrats and this is a great framework to have!!
I once watched Emina’s talk about rosette, its symbolic evaluators has a very clever approach which can avoid path explosion and generate compact encodings by properly merging states.
I’m trying to run sandboxes in places, but when the sandboxes need access to racket/gui
(such as through 2htdp/universe
), they get cannot instantiate racket/gui/base' a second time
. I’ve tried initing racket/gui
once in the server that starts the places, but this doesn’t seem to work. (gui-available?)
is still false in started places, and they still raise the exception when the sandbox tries to load the gui module. Any thoughts?
It would be great to have an answer for this on the mailing list.
Is it time the “cannot instantiate racket/gui/base’ a second time” error got its own wiki-page?
@spdegabrielle
I thought that was something you could do with units?
Not really sure how units come into this.
I’ll be honest I’m out of my depth- I thought I remembered someone using units to instantiate gui a second time for tricksy testing.
I don’t really WANT to instantiate gui a second time, I just want it available to sandboxes in N different places.
I’m guessing you have a hand in server that needs to run student submissions that call gui
Yeah. and we have a lot of students hammering it so we’re trying to parallelize to increase throughput.
I’ll try find the mention I saw
Maybe others have better answers — but places have separate Racket VM instances, so I guess it is not possible to share the instantiations of racket/gui across places
I’m assuming it does have a virtual display xvfb-run racket -l handin-server
yes
And I think it dynamic-require
‘s in each student program.
Just runs a sandbox
evaluator on it, whatever that does.
Hm it looks like there’s some difference in behaviour between macOS and other platforms… “on Mac OS, the sole instantiation of https://docs.racket-lang.org/gui/index.html\|racket/gui/base must be in the process’s original https://docs.racket-lang.org/reference/places.html#%28tech._place%29\|place.” https://docs.racket-lang.org/gui/Startup_Actions.html
Not sure what this means exactly
I think that’s because Mac’s event loop has to be from the main thread, while other platforms don’t have this constraint
These three don’t seem to work together: • Places can’t share module instantiations (my guess) • racket/gui can be instantiated exactly once per process • Places by default run in the same process
Is there a way to make a place run in a different process?
I don’t think so: “A place is a parallel task that is effectively a separate instance of the Racket virtual machine, although all places run within a single operating-system process. “ https://docs.racket-lang.org/reference/places.html\|https://docs.racket-lang.org/reference/places.html
https://docs.racket-lang.org/guide/parallelism.html#%28part._distributed-places%29\|https://docs.racket-lang.org/guide/parallelism.html#%28part._distributed-places%29 Distributed places may be a way around that limitation - but I am guessing as I have no experience in this.
Hm, so I don’t seem to have the same issue on linux, only on macos. places executes the sandbox just fine.
Sounds like good news?
.. maybe .. unless I’ve just masked the error somehow…
Yeah nevermind, I didn’t set things up right.
I’d like to make a Handin server page on the wiki. With advice like ‘avoid macOS for 2htdp/universe’ (if true) and ‘start a virtual display with xvfb-run racket -l handin-server
‘
Nice! I’m trying places and racket/gui on Linux but it doesn’t work. Didn’t thought about sandboxes.
And I’ve heard of distributed places but that’s all I know :disappointed:
No it still doesn’t work on linux; something else in the server wasn’t setup correctly and it masked the gui error.
I copied something from the Racket Guide #lang racket/base
(require racket/place racket/place/distributed)
(define rems '())
(for ([i (in-range 3)])
(define rem
(spawn-remote-racket-node "127.0.0.1" #:listen-port (+ 1234 i)))
(set! rems (cons rem rems))
(displayln rem)
(define pl (supervise-place-at rem "get-gui.rkt" 'go))
(sleep 2))
and this produces logs ~$ cat get-gui.rkt
#lang racket/base
(require racket/gui racket/place racket/os racket/system)
(provide go)
(define (go chan)
(with-output-to-file "get-gui-txt.log" #:exists 'append
(lambda ()
(printf "in go ~s!\n~s\n\n" (getpid) chan)))
"go!")
ugh. that would require a lot of additional rewriting…
Might be easier to provide a fake gui or universe library to the sandbox.
You gotta ask this on racket users- there must be more educators who use handin with 2htdp/universe programs
Sorry I was no help
No worries, thanks for the support
Please let me know when you solve it so I can add a handin server page to the wiki
Well we’ve deployed and it seems to be working. Adding a 2htdp/universe
override to the overridden collections seems to be the way to go. It would be nice if handin came with that in its overridden-collects.
@joel638 has joined the channel
I’ve struggled with this in Racket Mode over the years.
One approach, which I did for a long time, was to use a custom module name resolver to catch the first such attempt to use racket/gui/base when the user runs a program, stop, require it in Racket Mode’s main namespace, then restart the user’s program. So a “lazy” approach.
More recently, I’ve been eagerly requiring it on startup, then, using namespace-attach-module to attach it to the namespace initially used for a REPL or a module->namespace.
There are pros and cons, different edge cases, each way.
The gist of the latter approach is here: https://github.com/greghendershott/racket-mode/blob/master/racket/gui.rkt (although some of the edge cases are handled in repl.rkt and interactions.rkt).
Oh, sorry, I think I overlooked the wrinkle that you’re using places.
So, places count as “a single Racket process”, but as @spdegabrielle already pointed out distributed places could work… but as @wjb already said that would be a bigger change. So, never mind me, sorry. :disappointed:
Was there a resolution here? Is it something anyone else needs to worry about?
No worries. For what it’s worth, I had already looked at racket mode and tried to see if a similar approach would work with places. That answer seems to be no. I think I’d need namespaces to be serializable and allowed over place channels, which.. doesn’t sound like a sensible thing.
It seems the issue has resolved itself (locally that seems to have happened on my machine), or @mflatt was able to fix the pkg-build server by modifying the trust store as discussed above (the package server seems to be able to access the offending servers again).
So I don’t see an urgent reason that anyone else needs to worry about this for now.