Welcome, Guest. Please login or register.

Author Topic: duktape error NetSurf OS3  (Read 33455 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline DNADNL

  • Jr. Member
  • **
  • Join Date: Jun 2016
  • Posts: 87
    • Show all replies
Re: duktape error NetSurf OS3
« Reply #59 from previous page: August 01, 2016, 07:00:26 PM »
OK, here is the compilation issue, more specifically :
Code: [Select]
content/handlers/javascript/duktape/dukky.c:580: error: syntax error before "if"

OK, that comes from the file I use to replace dukky.c, sorry ! XD
 

Offline DNADNL

  • Jr. Member
  • **
  • Join Date: Jun 2016
  • Posts: 87
    • Show all replies
Re: duktape error NetSurf OS3
« Reply #60 on: August 01, 2016, 07:03:55 PM »
Quote from: chris;811957
Code: [Select]
content/handlers/javascript/duktape/dukky.c: In function `js_newcontext':
content/handlers/javascript/duktape/dukky.c:580: error: syntax error before "if"

Have a look at line 580 in content/handlers/javascript/duktape/dukky.c.  There's something odd before the "if".  Usually it means there's no semicolon at the end of line 579!



Yep.
Yes, that was my bad, sorry. ^^
 

Offline DNADNL

  • Jr. Member
  • **
  • Join Date: Jun 2016
  • Posts: 87
    • Show all replies
Re: duktape error NetSurf OS3
« Reply #61 on: August 01, 2016, 08:20:38 PM »
Is it normal this part of code is in a do while loop with the condition (0) ?
Code: [Select]
#if defined(DUK_USE_COMPUTED_NAN)
do {
/* Workaround for some exotic platforms where NAN is missing
* and the expression (0.0 / 0.0) does NOT result in a NaN.
* Such platforms use the global 'duk_computed_nan' which must
* be initialized at runtime.  Use 'volatile' to ensure that
* the compiler will actually do the computation and not try
* to do constant folding which might result in the original
* problem.
*/
volatile double dbl1 = 0.0;
volatile double dbl2 = 0.0;
duk_computed_nan = dbl1 / dbl2;
} while (0);

EDIT : It seems there are two DUK_INTERNAL void duk_hthread_create_builtin_objects(duk_hthread *thr) functins in duktape.c . Is it normal ?
« Last Edit: August 01, 2016, 10:09:33 PM by DNADNL »
 

Offline DNADNL

  • Jr. Member
  • **
  • Join Date: Jun 2016
  • Posts: 87
    • Show all replies
Re: duktape error NetSurf OS3
« Reply #62 on: August 01, 2016, 10:19:46 PM »
Quote from: chris;811971
If you haven't changed it, yes.
Very good answer ! ^^
 

Offline DNADNL

  • Jr. Member
  • **
  • Join Date: Jun 2016
  • Posts: 87
    • Show all replies
Re: duktape error NetSurf OS3
« Reply #63 on: August 01, 2016, 11:32:17 PM »
HEY, I'VE FOUND SOMETHING !
As I can see, there is a unending loop in duktape.c ! Yahoo !
Here is the NetSurf logged : https://dl.dropboxusercontent.com/u/101212919/NetSurf%20AmigaOS/BUGGINGNetSurf_3.6dev_AmigaOS3.tar
Take it, and launch it into Amikit with -v for example.

EDIT :
Here is the picture : https://dl.dropboxusercontent.com/u/101212919/NetSurf%20AmigaOS/Loop%20Error.png
It's in the DUK_INTERNAL void duk_hthread_create_builtin_objects(duk_hthread *thr) function (the big one, not the other).
I'm exhausted with all these LOGs, but so happy I've found something !
« Last Edit: August 02, 2016, 12:22:07 AM by DNADNL »
 

Offline DNADNL

  • Jr. Member
  • **
  • Join Date: Jun 2016
  • Posts: 87
    • Show all replies
Re: duktape error NetSurf OS3
« Reply #64 on: August 02, 2016, 03:52:06 PM »
Quote from: chris;811996
Are you sure it is looping?  With my much reduced logging it took ages for NetSurf to start up.  I'd expect the looping to stop and the fatal error to print eventually.
I'm not totally sure, but I can see that, when I launch a NetSurf version without duktape.c totally LOGged, The FATAL 56 appears in 3 seconds approx. , and when I launch the totally LOGged one, It takes approx 300 seconds to appear, and the issue doesn't apprear before.
I think it could be good to have a look at this function.

EDIT : I correct, with the totally LOGged version it doesn't stop. I think I unintentionnaly stopped it when I took a screenshot.
EDIT 2 : I correct again, with the totally LOGged version, it stops whenever it wants ! ^^
« Last Edit: August 02, 2016, 04:11:35 PM by DNADNL »
 

Offline DNADNL

  • Jr. Member
  • **
  • Join Date: Jun 2016
  • Posts: 87
    • Show all replies
Re: duktape error NetSurf OS3
« Reply #65 on: August 02, 2016, 06:01:34 PM »
Quote from: chris;812004
I don't really understand, but maybe you can log the variables in that function so we can get a clearer idea of what it is doing?
I can give a try, we don't ever know. ^^ How do I do with LOG to display a variable ?
 

Offline DNADNL

  • Jr. Member
  • **
  • Join Date: Jun 2016
  • Posts: 87
    • Show all replies
Re: duktape error NetSurf OS3
« Reply #66 on: August 02, 2016, 07:50:14 PM »
Quote from: chris;812007
Same as printf, eg:
LOG("Var: %d, String: %s, Ptr: %p", var, string, ptr);
The %d might need to be %ld.  It's usually worth just using %ld anyway, although gcc tends to complain about it.
OK, well, maybe the issue isn't in a loop. I was happy too fast ! ^^
Here is the last command before the FATAL 56 :
Code: [Select]
duk_eval_string(ctx, (const char *) duk_initjs_data);  /* initjs data is NUL terminated */
EDIT :
Either the Issue is coming from there :
duktape.h :
#define duk_eval_string(ctx,src)  \
   ((void) duk_eval_raw((ctx), (src), 0, 1 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN | DUK_COMPILE_NOFILENAME))

OR from there : duktape.c : (const char *) duk_initjs_data. (a data table)

OR from the variable ctx, but I don't think so...

EDIT 2 : I wonder if the issue doesn't come from the conversion of duk_initjs_data, so from (const char *) duk_initjs_data... what do you think about it ?

EDIT 3 : Here is the code leading to the issue :
Code: [Select]
(762.335685) duk_hthread_builtins.c:911 duk_hthread_create_builtin_objects: BIG duk_hthread_create_builtin_objects() : duk_push_string(ctx, many letters, ...)
(762.380520) duk_hthread_builtins.c:1017 duk_hthread_create_builtin_objects: BIG duk_hthread_create_builtin_objects() : duk_xdef_prop_stridx(ctx, DUK_BIDX_DUKTAPE, DUK_STRIDX_ENV, DUK_PROPDESC_FLAGS_WC);
(762.428497) duk_hthread_builtins.c:1028 duk_hthread_create_builtin_objects: BIG duk_hthread_create_builtin_objects() : DUK_DD(DUK_DDPRINT(running built-in initjs));
(762.473715) duk_hthread_builtins.c:1030 duk_hthread_create_builtin_objects: BIG duk_hthread_create_builtin_objects() : duk_eval_string(ctx, (const char *) duk_initjs_data);
(762.518614) duk_hthread_builtins.c:1031 duk_hthread_create_builtin_objects: BIG duk_hthread_create_builtin_objects() : ctx = 298973952
FATAL 56: uncaught error
PANIC 56: uncaught error (calling abort)
Abnormal program termination
NetSurf : erreur code 20

EDIT 4 : It's in here : rc = duk_compile_raw(ctx, src_buffer, src_length, comp_flags); In duktape.c (I think I won't finish to follow the tracks today ! XD)

EDIT 5 : Now, it's in there : DUK_LOCAL duk_ret_t duk__do_compile(duk_context *ctx)

EDIT 6 : Just a question about this part of code :
Code: [Select]
if (flags & DUK_COMPILE_NOSOURCE) {
;
} else {
duk_remove(ctx, -2);
}
Why is there only a semi-colon in the if ? I wonder if the if souldn't be like this :
Code: [Select]
if !flags || !DUK_COMPILE_NOSOURCE) {
duk_remove(ctx, -2);
}

EDIT 7 : coming from here : duk_js_compile(thr, comp_args->src_buffer, comp_args->src_length, comp_flags);
... Where will it stop ?
« Last Edit: August 02, 2016, 10:58:34 PM by DNADNL »
 

Offline DNADNL

  • Jr. Member
  • **
  • Join Date: Jun 2016
  • Posts: 87
    • Show all replies
Re: duktape error NetSurf OS3
« Reply #67 on: August 03, 2016, 06:59:28 PM »
OK, I go on LOGging everything, but I can see I'm LOGging the error functions. So, I think I've put tracks on the way to obtain the issue. Here is the code :
Code: [Select]
(525.303815) duk_js_compiler.c:7791 duk_js_compile: duk_js_compile() : comp_stk.comp_ctx_alloc.lex.input_length = src_length;
(525.341080) duk_js_compiler.c:7794 duk_js_compile: duk_js_compile() : duk_push_pointer(ctx, (void *) &comp_stk);
(525.377255) duk_js_compiler.c:7799 duk_js_compile: duk_js_compile() : prev_ctx = thr->compile_ctx;
(525.413752) duk_js_compiler.c:7801 duk_js_compile: duk_js_compile() : thr->compile_ctx = &comp_stk.comp_ctx_alloc;
(525.449799) duk_js_compiler.c:7803 duk_js_compile: duk_js_compile() : safe_rc = duk_safe_call(ctx, duk__js_compile_raw, 2 /*nargs*/, 1 /*nret*/);
(525.504379) duk_error_longjmp.c:9 duk_err_longjmp: duk_err_longjmp() BEGIN
(525.549729) duk_error_longjmp.c:10 duk_err_longjmp: duk_err_longjmp() : DUK_ASSERT(thr != NULL);
(525.584814) duk_error_longjmp.c:13 duk_err_longjmp: duk_err_longjmp() : DUK_DD(DUK_DDPRINT(longjmp error: type=290914608 iserror=315533536 value1=!T value2=!T, (int) thr->heap->lj.type, (int) thr->heap->lj.iserror, &thr->heap->lj.value1, &thr->heap->lj.value2));
(525.643888) duk_error_longjmp.c:27 duk_err_longjmp: duk_err_longjmp() : if (!thr->heap->lj.jmpbuf_ptr) BEGIN
(525.679870) duk_error_longjmp.c:40 duk_err_longjmp: duk_err_longjmp() : if (!thr->heap->lj.jmpbuf_ptr) END
(525.714571) duk_error_longjmp.c:51 duk_err_longjmp: duk_err_longjmp() : DUK_LONGJMP(thr->heap->lj.jmpbuf_ptr->jb);
(525.750039) duk_js_compiler.c:7805 duk_js_compile: duk_js_compile() : thr->compile_ctx = prev_ctx;
(525.784035) duk_js_compiler.c:7808 duk_js_compile: duk_js_compile() : if (safe_rc != DUK_EXEC_SUCCESS) BEGIN
(525.817388) duk_js_compiler.c:7810 duk_js_compile: duk_js_compile() : if (safe_rc != DUK_EXEC_SUCCESS) : duk_throw(ctx);
(525.852152) duk_api_stack.c:4309 duk_throw: duk_throw() BEGIN
(525.880117) duk_api_stack.c:4310 duk_throw: duk_throw() : duk_hthread *thr = (duk_hthread *) ctx;
(525.911546) duk_api_stack.c:4313 duk_throw: duk_throw() : DUK_ASSERT(thr->valstack_bottom >= thr->valstack);
(525.944771) duk_api_stack.c:4315 duk_throw: duk_throw() : DUK_ASSERT(thr->valstack_top >= thr->valstack_bottom);
(525.977932) duk_api_stack.c:4317 duk_throw: duk_throw() : DUK_ASSERT(thr->valstack_end >= thr->valstack_top);
(526.009874) duk_api_stack.c:4320 duk_throw: duk_throw() : if (thr->valstack_top == thr->valstack_bottom) BEGIN
(526.044699) duk_api_stack.c:4325 duk_throw: duk_throw() : if (thr->valstack_top == thr->valstack_bottom) END
(526.078504) duk_api_stack.c:4336 duk_throw: duk_throw() : duk_hthread_sync_and_null_currpc(thr);
(526.110254) duk_api_stack.c:4340 duk_throw: duk_throw() : DUK_DDD(DUK_DDDPRINT(THROW ERROR (API): !dT (before throw augment), (duk_tval *) duk_get_tval(ctx, -1)));
(526.147969) duk_api_stack.c:4342 duk_throw: duk_throw() : duk_err_augment_error_throw(thr);
(526.182220) duk_api_stack.c:4345 duk_throw: duk_throw() : DUK_DDD(DUK_DDDPRINT(THROW ERROR (API): !dT (after throw augment), (duk_tval *) duk_get_tval(ctx, -1)));
(526.219230) duk_api_stack.c:4348 duk_throw: duk_throw() : duk_err_setup_heap_ljstate(thr, DUK_LJ_TYPE_THROW);
(526.253096) duk_api_stack.c:4356 duk_throw: duk_throw() : duk_err_longjmp(thr);
(526.283755) duk_error_longjmp.c:9 duk_err_longjmp: duk_err_longjmp() BEGIN
(526.312810) duk_error_longjmp.c:10 duk_err_longjmp: duk_err_longjmp() : DUK_ASSERT(thr != NULL);
(526.344496) duk_error_longjmp.c:13 duk_err_longjmp: duk_err_longjmp() : DUK_DD(DUK_DDPRINT(longjmp error: type=290914608 iserror=315598072 value1=!T value2=!T, (int) thr->heap->lj.type, (int) thr->heap->lj.iserror, &thr->heap->lj.value1, &thr->heap->lj.value2));
(526.397541) duk_error_longjmp.c:27 duk_err_longjmp: duk_err_longjmp() : if (!thr->heap->lj.jmpbuf_ptr) BEGIN
(526.433121) duk_error_longjmp.c:30 duk_err_longjmp: duk_err_longjmp() : if (!thr->heap->lj.jmpbuf_ptr) : DUK_D(DUK_DPRINT(uncaught error: type=290914608 iserror=315598072 value1=!T value2=!T, (int) thr->heap->lj.type, (int) thr->heap->lj.iserror, &thr->heap->lj.value1,
 &thr->heap->lj.value2));
(526.505425) duk_error_longjmp.c:35 duk_err_longjmp: duk_err_longjmp() : if (!thr->heap->lj.jmpbuf_ptr) : duk_fatal((duk_context *) thr, DUK_ERR_UNCAUGHT_ERROR, uncaught error);
FATAL 56: uncaught error
PANIC 56: uncaught error (calling abort)
Abnormal program termination
NetSurf : erreur code 20

So that could mean either the problem comes from
duk_js_compile() : safe_rc = duk_safe_call(ctx, duk__js_compile_raw, 2 /*nargs*/, 1 /*nret*/);
OR from
duk_js_compile() : if (safe_rc != DUK_EXEC_SUCCESS) : duk_throw(ctx);

But now I don't know how to be sure about that...

EDIT : I can't go further for the LOGs, so I think the Issue is there.
« Last Edit: August 03, 2016, 07:11:11 PM by DNADNL »
 

Offline DNADNL

  • Jr. Member
  • **
  • Join Date: Jun 2016
  • Posts: 87
    • Show all replies
Re: duktape error NetSurf OS3
« Reply #68 on: August 04, 2016, 04:04:23 PM »
Quote from: chris;812059
duk_throw is the function which triggers the fatal, which means duk_safe_call is returning something other than DUK_EXEC_SUCCESS.

It would be useful to know:
(a) what duk_safe_call is actually returning.
(b) to find out where in duk_safe_call it is returning the error.
OK. We worked on this with Tygre yesterday. We saw the problem could be in
Code: [Select]
DUK_LOCAL duk_ret_t duk__js_compile_raw(duk_context *ctx).
I'm going to check this out.
 

Offline DNADNL

  • Jr. Member
  • **
  • Join Date: Jun 2016
  • Posts: 87
    • Show all replies
Re: duktape error NetSurf OS3
« Reply #69 on: August 05, 2016, 07:55:45 PM »
OK, I reached the same part of code than you, chris :
Code: [Select]
if (expect >= 0 && comp_ctx->curr_token.t != expect) {
DUK_D(DUK_DPRINT("parse error: expect=%ld, got=%ld",
                (long) expect, (long) comp_ctx->curr_token.t));
DUK_ERROR_SYNTAX(thr, DUK_STR_PARSE_ERROR);
}

With Tygre, we climbed back up to this line (in duktape.c : duk__parse_func_like_fnum() ) :
Code: [Select]
duk__advance_expect(comp_ctx, DUK_TOK_RCURLY);
We think the JavaScript code used to test duktape during the NetSurf launch is responsible of the issue. Is it possible to know what is the JavaScript code executed during the NetSurf launch ? (we thought first that the NetSurf Welcome page executed Javascript code to explain the issue, but that's not the case).

However, it's quite disappointing and not handy if NetSurf crashes only because a JavaScript test script...
« Last Edit: August 05, 2016, 08:04:34 PM by DNADNL »
 

Offline DNADNL

  • Jr. Member
  • **
  • Join Date: Jun 2016
  • Posts: 87
    • Show all replies
Re: duktape error NetSurf OS3
« Reply #70 on: August 05, 2016, 11:39:37 PM »
Quote from: freeaks;812133
@dnadnl,
i've just tested your build from github, i have to report: it is quite slower than chrisY's and the color are wrong too. (tested on uae, rtg)

@chrisY: your build is faster, color are good.
is there anychance you could release a nofpu build so vampire owner could use you netsurf port ?

fpu support for vampire is coming, but meanwhile there's a good number of users that cannot run your build of netsurf and would like to play with it a lot :)

myself too i ordered a vampire so, there is interest for your 68k port of netsurf, thanks for doing it!
As I said before and in the README (if I recall well), the NetSurf AmigaOS3 version on my GitHub isn't updated every day, so some changes are not included in (that's the case for the images). But I'll compile it again, now.
 

Offline DNADNL

  • Jr. Member
  • **
  • Join Date: Jun 2016
  • Posts: 87
    • Show all replies
Re: duktape error NetSurf OS3
« Reply #71 on: August 05, 2016, 11:52:20 PM »
Quote from: chris;812137
AFAIK it doesn't run any tests on startup.  Might be a question for the netsurf-dev mailing list (or IRC).
I don't know how to find this IRC, so maybe I'll let you ask the question ! ^^
 

Offline DNADNL

  • Jr. Member
  • **
  • Join Date: Jun 2016
  • Posts: 87
    • Show all replies
Re: duktape error NetSurf OS3
« Reply #72 on: August 06, 2016, 12:06:55 AM »
@utri007 & @freeaks OK, the NetSurf Archive available in my GitHub is now whole new fresh (without DukTape) ! ^^ You can test it if you want.
 

Offline DNADNL

  • Jr. Member
  • **
  • Join Date: Jun 2016
  • Posts: 87
    • Show all replies
Re: duktape error NetSurf OS3
« Reply #73 on: August 06, 2016, 12:21:01 AM »
Quote from: utri007;812139
I don't know how old compile Chris' version is, but there shouldn't be a big diffrence? Could you compile it like apj hinted?



That would make many Vampire FPGA accelerator users happy
Oh, I don't know how to compile for this, sorry... But if you have some Web links, I could go to check if I can do something, but I can't guarantee.
 

Offline DNADNL

  • Jr. Member
  • **
  • Join Date: Jun 2016
  • Posts: 87
    • Show all replies
Re: duktape error NetSurf OS3
« Reply #74 on: August 06, 2016, 12:24:37 AM »
Quote from: utri007;812145
Download link doesn't work

https://github.com/DNADNL/NetScript gives 404 error
Oops, I forgot to change it in the README ! ^^ It's OK, now. Here is the link if you want : https://github.com/DNADNL/NetScript/raw/master/NetSurf_3.6dev_AmigaOS3_2016-08-05.tar