-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Web API for base robot outputs 800MB per minute #2106
Comments
The same thing happens with the sliding puzzle solution: swarm --scenario data/scenarios/Challenges/Sliding\ Puzzles/3x3.yaml --autoplay |
For comparison, here are the number of lines of the examples: for f in example/*; do wc -l $f; done | sort -n
And here is the length of the output JSON - measured in lines of the indented human readable JSON: curl -s localhost:5357/robot/0 | jq '.program' | wc -l
|
Maybe we can analyze the swarm --scenario blank --run example/rectypes.sw
curl -s localhost:5357/robot/0 | yq -P '.program' | sed 's/^ *//;s/ *$//' | sort | uniq -c | sort -n These 3000 repetitions of source positions stand out to me:
Looking in the file the character positions 571, 575 and 582 would correspond to: def cons : a -> List a -> List a = \x. \l. inr (x, l) end
^ ^ ^ So |
Yes, I'm pretty sure I know exactly why this is happening, see #1907 (comment) . I don't think there's anything about Many continuation stack frames in a robot's CESK machine contain an To solve this we will have to either (1) recover the sharing when serializing somehow, or (2) store things in the first place that makes the sharing more explicit. |
@byorgey in the linked issue, I meanwhile arrived to the idea (1). 😄 I would very much like (2) but it sounds like a big rewrite. Though it might be necessary if we want to serialize/deserialize robots and (1) turns out to not work. 🤔 |
I mean, this is also going to be a critical component to #50 , so (2) could be worth it. I think (1) will work, I am just worried about making it efficient. |
Describe the bug
Trying to get base log after
run "example/list.sw"
does not terminate - at least not in any reasonable time.Thats because the output is flooded with infinite (or exponential) stream of JSON
Syntax
:To Reproduce
Run swarm:
swarm --scenario creative --run "example/list.sw"
Get the output using cURL - I suggest piping to
wc
for 60 seconds.Optionally observe the process memory usage with
ps
,top
, or an alternative likebtop
.Converting to gigabytes:
robot/0
outputted 0.874 GB of JSONExpected behavior
I wanted to get base log, i.e. this command should work:
Unfortunately, there are gigabytes of JSON of swarm syntax before the log.
Ideally, the syntax
ToJSON
should be usable, but I could use workarounds likerobot/0/log
to get the log directly or maybe if it was placed before the syntax, I could extract it and stop cURL output.Screenshots
Additional context
Given that the list example was only parsed and the functions were not run, this issue likely affects other solutions as well.
The other example files did not cause this magnitude of syntax output, but it's possible some other solutions would.
The text was updated successfully, but these errors were encountered: