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

Assertion '!throws' failed in iotjs_jhelper_call_ok #1360

Closed
renatahodovan opened this issue Dec 8, 2017 · 3 comments
Closed

Assertion '!throws' failed in iotjs_jhelper_call_ok #1360

renatahodovan opened this issue Dec 8, 2017 · 3 comments
Labels

Comments

@renatahodovan
Copy link
Contributor

IoT.js version:
Checked revision: dbd52a7
Build command: tools/build.py --buildtype=debug
OS:
Ubuntu 17.10
Test case:
process.on('exit', function() {});       
setTimeout(function() { Array.prototype.slice += 'B' }, 500);       
Backtrace:
iotjs/src/iotjs_binding.c:330: Assertion '!throws' failed.

[Backtrace]:

(gdb) bt
#0  iotjs_jhelper_call_ok (jfunc=2155, jthis=72, jargs=0x555555841020 <jargs_empty>) at iotjs/src/iotjs_binding.c:330
#1  0x0000555555571d05 in iotjs_process_next_tick () at iotjs/src/iotjs_binding_helper.c:89
#2  0x0000555555571e11 in iotjs_make_callback_with_result (jfunction=15859, jthis=14835, jargs=0x555555841020 <jargs_empty>)
    at iotjs/src/iotjs_binding_helper.c:125
#3  0x0000555555571dac in iotjs_make_callback (jfunction=15859, jthis=14835, jargs=0x555555841020 <jargs_empty>)
    at iotjs/src/iotjs_binding_helper.c:108
#4  0x0000555555581b1c in iotjs_timerwrap_on_timeout (timerwrap=0x555555883790)
    at iotjs/src/modules/iotjs_module_timer.c:92
#5  0x0000555555581796 in TimeoutHandler (handle=0x5555558837e0) at iotjs/src/modules/iotjs_module_timer.c:59
#6  0x00005555555fc78e in uv__run_timers (loop=0x555555841640 <default_loop_struct>)
    at iotjs/deps/libtuv/src/unix/timer.c:203
#7  0x00005555555f22f3 in uv_run (loop=0x555555841640 <default_loop_struct>, mode=UV_RUN_ONCE)
    at iotjs/deps/libtuv/src/unix/core.c:318
#8  0x000055555556f57b in iotjs_start (env=0x555555841440 <current_env>) at iotjs/src/iotjs.c:147
#9  0x000055555556f8f5 in iotjs_entry (argc=2, argv=0x7fffffffdec8) at iotjs/src/iotjs.c:218
#10 0x000055555556f0da in main (argc=2, argv=0x7fffffffdec8) at iotjs/iotjs_linux.c:19

Found by Fuzzinator with grammarinator

@glistening
Copy link
Contributor

glistening commented Dec 12, 2017

I wonder why Array.prototype.slice += 'B' throws error.
iotjs throws TypeError for assigning non-function to function while others (jerry, node, jsc, etc.) don't.

$ cat t.js
Array.prototype.slice = null

$ iotjs t.js 
uncaughtException: TypeError: Expected a function.
$ jerry t.js  // no error
$ node t.js // no error

It is another bug that we must resolve before fixing the originally intended type of bug.

@DanielBallaSZTE
Copy link
Contributor

DanielBallaSZTE commented Feb 15, 2018

@glistening I think it is the normal behaviour since:
Array.prototype.slice is set to null, that doesn't throw an error.
Evaluating Array.prototype.slice equals null.
However, in iotjs.js:95 there's a var callbacks = nextTickQueue.slice(0); which as slice expects a function.
I've checked in v8, and it has the same behaviour with the below code:

Array.prototype.slice = null;
var a = [3, 4, 5, 6];
a.slice(0);
TypeError: a.slice is not a function

DanielBallaSZTE pushed a commit to DanielBallaSZTE/iotjs that referenced this issue Feb 15, 2018
Fixes issue jerryscript-project#1360

IoT.js-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
DanielBallaSZTE pushed a commit to DanielBallaSZTE/iotjs that referenced this issue Feb 15, 2018
Fixes issue jerryscript-project#1360

IoT.js-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
DanielBallaSZTE pushed a commit to DanielBallaSZTE/iotjs that referenced this issue Feb 15, 2018
Fixes issue jerryscript-project#1360

IoT.js-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
DanielBallaSZTE pushed a commit to DanielBallaSZTE/iotjs that referenced this issue Feb 15, 2018
Fixes issue jerryscript-project#1360

IoT.js-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
DanielBallaSZTE pushed a commit to DanielBallaSZTE/iotjs that referenced this issue Feb 16, 2018
Fixes issue jerryscript-project#1360

IoT.js-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
yichoi pushed a commit that referenced this issue Feb 19, 2018
Fixes issue #1360

IoT.js-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
DanielBallaSZTE pushed a commit to DanielBallaSZTE/iotjs that referenced this issue Feb 19, 2018
Fixes issue jerryscript-project#1360

IoT.js-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
@DanielBallaSZTE
Copy link
Contributor

The issue is resolved, and can be closed.

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

No branches or pull requests

4 participants