Skip to content
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

REPL output sometimes cuts off/drops early #164

Open
kwshi opened this issue Sep 29, 2022 · 1 comment
Open

REPL output sometimes cuts off/drops early #164

kwshi opened this issue Sep 29, 2022 · 1 comment

Comments

@kwshi
Copy link

kwshi commented Sep 29, 2022

Sometimes, the REPL doesn't print output that it's supposed to print, and the program prematurely ends before all output has been sent. Example-- the following program prints 0 through 9; when this program is run, most of the times the correct output is shown but sometimes, seemingly at random, the output cuts off early:

image

Inspecting the websocket message log shows the following exchange:

  • (up) {"event":"runCode","code":"#include <iostream>\n\nint main() {\n for (int i = 0; i < 10; ++i) {\n std::cout << i << std::endl;\n }\n}\n"}
  • (down) {"event":"terminalClear"}
  • (down) {"event":"terminalOutput","output":"0\r\n1\r\n2\r\n3\r\n"}
  • (down) {"event":"serviceFailed","service":"terminal","error":"Exited with status 0","code":0}
  • (down) {"event":"terminalInput","input":"\r"}

So it seems like the missing output is not transmitted at all by the server, rather than it being hidden by some UI-level bug.

(Another example, in which the last output line hello is dropped:)
image

  • (up) {"event":"runCode","code":"#include <iostream>\n\nint main() {\n for (int i = 0; i < 5; ++i) {\n std::cout << i << std::endl;\n }\n\n int n;\n std::cin >> n;\n\n std::cout << \"hello \" << n << std::endl;\n}\n"}
  • (down) {"event":"terminalClear"}
  • (down) {"event":"terminalOutput","output":"0\r\n1\r\n2\r\n3\r\n4\r\n"}
  • (up) {"event":"terminalInput","input":"7"}
  • (down) {"event":"terminalOutput","output":"7"}
  • (down) (down) {"event":"serviceFailed","service":"terminal","error":"Exited with status 0","code":0}
@raxod502
Copy link
Member

raxod502 commented Oct 5, 2022

Huh, that's very odd, I'm not sure what could be causing this. The process management code needs a serious rewrite, I suspect it has a number of potential race conditions because I wrote my own thing instead of using an existing container runtime like Kubernetes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants