spdegabrielle
2019-12-17 10:04:50

@sorawee is this right? I think sta1 below is working as a static method of the class counter%? #lang racket/gui (define counter% (let* ([total 0] (sta1 (λ () (+ 20 total)))) (class object% (field (current-count 0)) (define/public (tada) (sta1)) (super-new) (define/public (get-count) current-count) (define/public (next) (set! current-count (+ current-count 1)) (set! total (+ total 1)) (list current-count total))))) (define c1 (new counter%)) (define c2 (new counter%)) (send c1 next) (send c1 next) (send c1 tada) (send c1 next) (send c2 next) (send c1 tada) (send c2 tada)


spdegabrielle
2019-12-17 10:19:28

This :point_up_2: was derived from a so answer by @soegaard2


spdegabrielle
2019-12-17 10:41:16

I really should generalise this as a macro


laurent.orseau
2019-12-17 10:45:19

@mflatt I’m seeing some huge spikes in memory usage with Racket CS, up to 13GB even when using with-limits at 2GB (ending up freezing my computer since I run several such processes in parallel). My guess: • GC is postponed during the intensive CPU usage and ends up eating a lot of memory before with-limits can realize it’s way over 2GB. • Racket CS uses pre-allocated cons cells and when it runs out it doubles the previous amount. [edit: wrong] If that happens to be correct, then I think the doubling strategy is way too aggressive when memory is bounded. Also, before increasing the memory, it may be a good time to first check if the limit imposed by with-limits is not reached. Do I have some better control over all this?


mflatt
2019-12-17 13:07:23

Which version of Racket CS are you using?


laurent.orseau
2019-12-17 13:11:45

Racket v7.5.0.11 [cs]


mflatt
2019-12-17 13:34:00

My guess is that there’s some leak in Racket CS that causes it not to bound the memory use of your application as it should. Is it something that I can run?


laurent.orseau
2019-12-17 13:42:44

I can’t share it for now unfortunately. However, once the function using with-limit terminates, I force a GC and memory comes back to normal (according to htop). Does that still count as a memory leak?


mflatt
2019-12-17 13:47:37

Yes, I’m imagining it’s a kind of “leak” where the sandboxed data is reachable from outside the sandbox.


samth
2019-12-17 14:03:34

Static methods, as @spdegabrielle points out, are just functions


samth
2019-12-17 14:03:59

Instead of fromX I’d call it X->Y


mila
2019-12-17 14:37:12

@mila has joined the channel


laurent.orseau
2019-12-17 14:45:57

Based on your comment, I could make this program eat up to 9GB despite the 1GB limit.


laurent.orseau
2019-12-17 14:47:09

Replacing (set! a-tree tree) with (set! a-tree (length tree)) doesn’t have the same bad behaviour (it still uses twice what it should do, which is not so great though)


mflatt
2019-12-17 14:54:50

Well, that’s a leak, but a deliberate one! It’s the same with traditional Racket and Racket CS, right?


mflatt
2019-12-17 14:55:25

Your real program works correctly with traditional Racket and not with Racket CS, right?


laurent.orseau
2019-12-17 15:03:13

I think so. I say ‘I think’ because I’ve made a number of changes after the switch. Getting to the bad behaviour takes a long time so no so easy to check.

Also, I return only statistics through with-limits, like lengths and numbers, but not trees and such.

Regarding the intentional leak above, my expectation would still be that the program should break.


mflatt
2019-12-17 15:08:58

The tree program above just cannot work like you want. Accounting is based on reachability (not on, say, allocation time), and only those values reachable specifically from the sandbox will be charged to the sandbox.


spdegabrielle
2019-12-17 15:15:11

@samth is my example idiomatic? Or would you do it differently?


laurent.orseau
2019-12-17 15:17:35

I see. Then it may be because I just added some children relations in my program, and some root objects that live outside with-limits may hold some children. Since these may be reached from outside with-limits, they are not counted by it, is that correct?


mflatt
2019-12-17 15:17:53

That’s correct.


laurent.orseau
2019-12-17 15:20:04

Ok. Thanks for the explanation. I’ll make copies of the root object inside with-limits instead, and see if that solves it.


samdphillips
2019-12-17 16:54:23

Isn’t it only visible inside of the class though? Like you can’t provide that “static method”


spdegabrielle
2019-12-17 17:02:26

@samdphillips maybe ? #lang racket/gui (define staticmethod void) (define counter% (let* ([total 0] (sta1 (λ () (+ 20 total)))) (class object% (field (current-count 0)) (set! staticmethod sta1) (super-new) (define/public (get-count) current-count) (define/public (next) (set! current-count (+ current-count 1)) (set! total (+ total 1)) (list current-count total))))) (define c1 (new counter%)) (define c2 (new counter%)) (send c1 next) (send c1 next) (staticmethod) (send c1 next) (send c2 next) (staticmethod) not very elegant. I should work out a way to make a macro on top of class


deactivateduser60718
2019-12-17 17:35:06

Why is it that when a package build fails all of the online documentation for a collection vanishes? I made a mistake by leaving out a dependency in polyglot and now all of my docs are gone.


deactivateduser60718
2019-12-17 17:35:23

I thought there would be some kind of protection against that kind of thing.


deactivateduser60718
2019-12-17 17:35:50

Is there something I need to configure?


samth
2019-12-17 17:41:46

deactivateduser60718
2019-12-17 17:42:15

I get a 404 when I visit that link


samth
2019-12-17 17:42:51

that’s quite odd, it works correctly for me


deactivateduser60718
2019-12-17 17:42:52

Looks like it gets rewritten too


deactivateduser60718
2019-12-17 17:43:37

Reproduces when I clear/disable cache


deactivateduser60718
2019-12-17 17:44:18

If you clear your cache/hard reload @samth, does it start to 404?


samth
2019-12-17 17:44:40

no, I’ve hard-reloaded several times


deactivateduser60718
2019-12-17 17:44:51

Yep, I’m confused.


samth
2019-12-17 17:45:13

I just opened another browser and it still works


deactivateduser60718
2019-12-17 17:49:41

I think I see what’s going on. Let me record a quick video.


deactivateduser60718
2019-12-17 17:55:33

It is actually cache-related, just not in the way I expected. When I produce the 404 the @polyglot is stripped from the link.

https://docs.racket-lang.org/polyglot-reference@polyglot/index.html

When I visit https://docs.racket-lang.org/polyglot-reference/index.html, that DOES 404.


deactivateduser60718
2019-12-17 17:56:41

I expected the latter link to still work.


deactivateduser60718
2019-12-17 17:56:46

Shouldn’t it?


samth
2019-12-17 17:57:19

I think it doesn’t work because of the build failure


deactivateduser60718
2019-12-17 17:58:57

That’s kind of what I was afraid of. I’ll reconfigure my package source on the index to divide stable/unstable.


deactivateduser60718
2019-12-17 17:59:32

I assumed that failed builds would not be allowed to proceed to have that impact.


laurent.orseau
2019-12-17 19:30:24

That seems to have solved it (for the most part). Thanks again!


anything
2019-12-18 00:52:18

Thanks! I’ll study that!


alexknauth
2019-12-18 01:18:41

I might have made slight progress. The Could not resolve hostname error is gone now, and now I’m getting the same error @ben was earlier, the timing out on ssh: Starting VirtualBox machine "racket-pkg-build" Waiting for VM "racket-pkg-build" to power on... VM "racket-pkg-build" has been successfully started. /usr/bin/ssh -R 18333:localhost:18333 racket@10.0.2.15 '/usr/bin/env' 'PLTUSERHOME=/home/racket/build-pkgs/user' 'PLT_PKG_BUILD_SERVICE=1' 'CI=true' 'PLTSTDERR=debug@pkg error' 'PLT_INFO_ALLOW_VARS=;PLT_PKG_BUILD_SERVICE' '/bin/sh' '-c' 'echo hello' ssh: connect to host 10.0.2.15 port 22: Operation timed out /usr/bin/ssh -R 18333:localhost:18333 racket@10.0.2.15 '/usr/bin/env' 'PLTUSERHOME=/home/racket/build-pkgs/user' 'PLT_PKG_BUILD_SERVICE=1' 'CI=true' 'PLTSTDERR=debug@pkg error' 'PLT_INFO_ALLOW_VARS=;PLT_PKG_BUILD_SERVICE' '/bin/sh' '-c' 'echo hello' ssh: connect to host 10.0.2.15 port 22: Operation timed out /usr/bin/ssh -R 18333:localhost:18333 racket@10.0.2.15 '/usr/bin/env' 'PLTUSERHOME=/home/racket/build-pkgs/user' 'PLT_PKG_BUILD_SERVICE=1' 'CI=true' 'PLTSTDERR=debug@pkg error' 'PLT_INFO_ALLOW_VARS=;PLT_PKG_BUILD_SERVICE' '/bin/sh' '-c' 'echo hello' ssh: connect to host 10.0.2.15 port 22: Operation timed out /usr/bin/ssh -R 18333:localhost:18333 racket@10.0.2.15 '/usr/bin/env' 'PLTUSERHOME=/home/racket/build-pkgs/user' 'PLT_PKG_BUILD_SERVICE=1' 'CI=true' 'PLTSTDERR=debug@pkg error' 'PLT_INFO_ALLOW_VARS=;PLT_PKG_BUILD_SERVICE' '/bin/sh' '-c' 'echo hello' ssh: connect to host 10.0.2.15 port 22: Operation timed out ssh: failed context...: /Users/Alex/Library/Racket/snapshot-7.5.0.13--2019-12-16/pkgs/remote-shell-lib/ssh.rkt:180:2: loop /Applications/Racket/2019-12-16/Racket v7.5.0.13/collects/racket/contract/private/arrow-val-first.rkt:555:3 /Users/Alex/Library/Racket/snapshot-7.5.0.13--2019-12-16/pkgs/pkg-build/main.rkt:452:5 /Users/Alex/Library/Racket/snapshot-7.5.0.13--2019-12-16/pkgs/pkg-build/main.rkt:445:2: install /Users/Alex/Library/Racket/snapshot-7.5.0.13--2019-12-16/pkgs/pkg-build/main.rkt:515:2: check-and-install /Users/Alex/Library/Racket/snapshot-7.5.0.13--2019-12-16/pkgs/pkg-build/main.rkt:123:0: build-pkgs "/Users/Alex/racket-pkg-build/run.rkt": [running body] temp35_0 for-loop run-module-instance! perform-require! Stopping VirtualBox machine "racket-pkg-build" 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% I think @ben said he solved this by having the vm & host exchange keys, with the host’s key in the authorized_keys of the vm (which I should have already), and the vm’s key in the known_hosts of the host (which I don’t have). I don’t really know how to do that


alexknauth
2019-12-18 01:23:36

On the other hand maybe it’s an /etc/network/interfaces problem, I don’t know

That file is still # interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback


ben
2019-12-18 02:00:30

for known_hosts you can either: • connect manually, answer (y) if it asks you whether to add an entry to known_hosts • open ~/.ssh/known_hosts in a text editor, add a new line with (1) the VM ip address (2) the keytype and (3) the public key example line: 192.168.99.100 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBMm9mr9OxT05yMFF6csABqY20k4OBQzM/DBkWu3mimcHwTyewWSG+ykP16TT93rss7iAdmXjUneTInfedlN80es=


ben
2019-12-18 02:01:32

but your problem might be that your host ssh key is protected with a password — you can fix that by making a new key


alexknauth
2019-12-18 04:39:39

I’m having trouble connecting manually for the first bullet point. And I don’t know what public key I should put for (3) in the second bullet point, since there’s no id_rsa.pub on the vm, at least not that I can find


sebi.f
2019-12-18 06:31:48

@sebi.f has joined the channel