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

Can't recover from infinite loops #35

Closed
kyldvs opened this issue Sep 6, 2015 · 4 comments
Closed

Can't recover from infinite loops #35

kyldvs opened this issue Sep 6, 2015 · 4 comments

Comments

@kyldvs
Copy link

kyldvs commented Sep 6, 2015

For example, just write while(true); in the transform script and the whole browser will freeze when the code is run.

(practically I ran into this by introducing some accidental infinite recursion)

Instead of solving the halting problem, it would be cool if we just put a timeout on the transform and killed it after 30 seconds or so.

@fkling
Copy link
Owner

fkling commented Sep 6, 2015

That wouldn't really help since the loop will block the event loop. The setTimeout callback would never run (or am I misunderstanding your suggestion?). The only solution would be to run the transform in a webworker.

@kyldvs
Copy link
Author

kyldvs commented Sep 6, 2015

Ah.. right. Is there enough support for webworkers across browsers that it would be reasonable to use them?

@kyldvs
Copy link
Author

kyldvs commented Sep 13, 2015

This is actually pretty annoying, while writing a completely safe for loop it's easy to cause an infinite loop and crash the tab. For example this puts you in an un-recoverable state if there's any valid statement after it.

const maxDepth = 3;
for (let i = 0; i < maxDepth;)

@fkling
Copy link
Owner

fkling commented Oct 20, 2015

This should be solved now with #39.

@fkling fkling closed this as completed Oct 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants