rchain-community / rchain.cloud

Online Rholang interpreter.
http://rchain.cloud
20 stars 8 forks source link

Inconsistent display of stdout #13

Open JoshOrndorff opened 6 years ago

JoshOrndorff commented 6 years ago

The "output" section does not consistently display the names sent to stdout and stdoutAck.

If I load the site and click run I usually see the expected output

@{"Hello"}
@{"Joe"}

But sometimes I get none of the output, or only some of it. Running the example code three to five times will usually produce at least one incorrect output.

See the attached screenshot. screenshot from 2018-06-01 15-07-58

tschoffelen commented 6 years ago

I've noticed this as well. Root of this problem is in the fact that stdout results are outputted in the node's tty, not the one of the client. So what we do is we capture the output of the node process for a little while until the client exists.

Sometimes that timing apparently doesn't line up correctly, and I don't really know what causes that at the moment.

JoshOrndorff commented 6 years ago

That root behavior hasn't changed in 0.4.1.

Do you spin up a now node container for every request sent? If so would capturing the output for a little while longer help?

If it's the same node for all requests is there a chance that my output will step on someone else's if we submit requests at the same time?

tschoffelen commented 6 years ago

It uses the same node (actually one of 5 load balanced nodes at the moment) as you already realised in #14 I believe.

Spinning up a new node would be way too slow, since it has a startup time of anywhere between 15-30 seconds, plus nodes currently use quite a lot of compute resources, so for the amount of users we currently have that isn't quite an option.

Capturing the output for slightly longer might already resolve part of the problem indeed, and I hope that as the RNode versions progress there might be more consistency in the moment and way that stdout output works.

dckc commented 6 years ago

What about spinning up a new node every night or every hour?

And display the node start time.

dckc commented 6 years ago

Or adding a "restart node" button?

(with a limitation that it can't be used again for 5 minutes)

tschoffelen commented 6 years ago

True, that would work, or even after X requests. With the load balancer in place, we could even take that node temporarily out of rotation for use on rchain.cloud.

Currently really busy, but will try to implement something like this in the next few weeks. Thanks for the input @dckc and @JoshOrndorff!

8lcarte commented 6 years ago

I'm also having this problem. After changing my message it reverts to my old messages.

-Lee [``]([url](url screen shot 2018-07-10 at 10 10 43 am ))

JoshOrndorff commented 6 years ago

What if you capture and display both stdout and stderr. Users who really want their output clearly can send it to stderr so it doesn't conflict with the other stuff coming on stdout.

Not a bad workaround in the meantime.

tschoffelen commented 6 years ago

I think this is only a display problem. In a later stage we might decide to indeed capture stdout and stderr separately. I think our current way of capturing output from the node doesn't differentiate between those types.

Since this issue was opened, however, we've made quite some improvements, and while still not 100% consistent, this seems to be less of a problem then it was before. Feel free to close this issue once it's at a point where you consider it acceptable.

tschoffelen commented 6 years ago

@8lcarte the thing you're flagging is slightly different from @JoshOrndorff original issue. Your Rholang code should look like this to work as you expect it to:

new coffeeShop {
    contract coffeeShop(order) = {
        stdout!("Hello!")
    } |
    coffeeShop!("Something")
}

In my (simplified) version of your example, coffeeShop is only defined in the scope of the new statement, so it's a different channel every time you execute the code, whereas with your version, you're using the same channel.