boa icon indicating copy to clipboard operation
boa copied to clipboard

Some Test262 tests can cause a stack overflow

Open Razican opened this issue 3 years ago • 3 comments

Describe the bug We are ignoring some Test262 tests because they cause a stack overflow in Boa. Here is the full list:

To Reproduce You can reproduce the behaviour by running the following command, after removing them from the test_ignore.txt file:

cargo run --release --bin boa_tester -- run -s {test_path}

Expected behavior The expected behaviour is, obviously, for them not to overflow the stack.

Razican avatar Jun 07 '21 09:06 Razican

Loaded test/language/expressions/tagged-template/tco-call.js into a debugger and got an exception during eval of EXC_BAD_ACCESS(code=2, address=...), seems to occur at a memory copy of some variety, will continue stepping through to work through it.

EDIT: The specific testcases mentioned create 7000 stack frames, compared to most testcases only having 20 stack frames.

Also, the specific cases seem to recurse into runs and call procedures that nests to this stack frame depth, with the sequence of 3 run stack frames at mod.rs 108:23 315:37 114:27 , followed by 2 call stack frames at context.rs 320:42 and gcobject.rs 327:9, followed by a call_construct stack frame at gcobject.rs 300:30. Seems to be a recursive loop involving these calls... No idea which mod.rs it's referring to in LLDB, but any help would be appreciated.

This could be resolved by #1323 ?

neeldug avatar Jun 19 '21 16:06 neeldug

I will try to give it a look in a couple of days, but something that can be tried is to see if the issue is in the parsing time or in the execution time, that would help a lot.

You can also try to extract a minimum example, especially if the issue is when parsing, and try to get all lexed tokens, to see if they make sense, by running the "boa" binary as mentioned in "DEBUGGING.md"

Razican avatar Jun 19 '21 20:06 Razican

Actually, ended up actually reading up on the feature the testcase is testing, it's tail-call optimisation, and explains why the number of stack frames is so large, i.e. this optimisation would need to be implemented on Boa's side to fix both of these from overflowing.

neeldug avatar Jun 19 '21 20:06 neeldug

@HalidOdat this got fixed by #2904 right?

raskad avatar May 07 '23 20:05 raskad

Yes, The tests no longer cause stack overflows, because a RuntimeLimit is thrown.

So we can close this issue :)

HalidOdat avatar May 07 '23 21:05 HalidOdat