Fable: fable repl (and repl2) locks up on bad input

Created on 29 Aug 2018  路  9Comments  路  Source: fable-compiler/Fable

Description

Given code with [0L..255L] (a known compiler bug) REPL locks up forever unresponsive trying to compile and run.

The problem is there is no way to change the bad code, stored in a cookie somewhere, without deleting all cookies on the PC used for this, which is a bit drastic.

It would be nice to have a compile timeout after 30s or something. Or an entry to repl that deletes the current remembered code.

Repro code

in repl or repl2:

let x = [0L..255L]

Expected and actual results

Please provide the expected and actual results.

Related information

  • Fable version (dotnet fable --version):
  • Operating system:

Most helpful comment

I now have two PCs on which I cannot use repl2 on either IE or Chrome. This is because they have got stuck in some state with inconsistent (or infinite loop inducing) persistent storage. Surely it would be quite easy to provide an entry url to repl2 that cleaned all possible persistent storage so that the page always loads as expected on a new PC? It would be a great help.

All 9 comments

Setting a delay isn鈥檛 possible because compilation time depends on computer hardware /browser and of the project too.

I would be in favor of storing the project info only when clicking a save button. And why not provide a restore / ignore feature as done in office

If I'm not wrong we're saving the code in the browser localStorage (we don't use cookies) only after a successful compilation so I'm assuming just refreshing should solve the issue. I guess we could add a timeout for compilation requests, but if this is really making the compiler hang we'd have to add a mechanism to kill the worker and restart it again, which would require some work.

The problem here is that it hangs when running, because the long range gets turned into an infinite loop! However this solves the problem: I can selectively clear localStorage!

I now have two PCs on which I cannot use repl2 on either IE or Chrome. This is because they have got stuck in some state with inconsistent (or infinite loop inducing) persistent storage. Surely it would be quite easy to provide an entry url to repl2 that cleaned all possible persistent storage so that the page always loads as expected on a new PC? It would be a great help.

Good idea! This should be easy to implement. Maybe something like repl2/#reset. I'll do it.

I started playing with this tonight (I've also sent a couple of PR's to fix the repl2 repo build issues).

The code is here, but I'm not 100% yet so I haven't sent a PR: https://github.com/xdaDaveShaw/repl2/tree/reset

Thanks @xdaDaveShaw! Code looks good to me, I just left a couple of minor comments in https://github.com/xdaDaveShaw/repl2/commit/14eb49051e37ce885b5b54b4973b345e3b9a8620#diff-335884fe2616b277d92d79a2ed3ac3ccR540 :+1:

A few git mistakes in my repo means that commit is no longer part of the branch.

I left some comments on that commit anyway, but then pushed another one.

I'll create a PR from these 2 commits to discuss. I'm not 100% happy with the changes, but they do seem to work - and I'm quite a newby to Fable/React/Elmish so feel free to suggest improvements.

This is now fixed because the long range infinite loop issue is cured!

But the reset option is also great (just tested) for other indefinite hold issues

Closing!

Was this page helpful?
0 / 5 - 0 ratings