Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Hang on non-existent worker source #298

Open
renatahodovan opened this issue May 11, 2024 · 0 comments · May be fixed by #335
Open

Hang on non-existent worker source #298

renatahodovan opened this issue May 11, 2024 · 0 comments · May be fixed by #335

Comments

@renatahodovan
Copy link
Contributor

When creating a Worker with a non-existent source, qjs throws a ReferenceError, but instead of exiting, it just hangs forever. I'm not familiar with the standard, but this seems like unexpected behavior.

Test case:

var worker = new os.Worker("nonexistent.js");
worker.onmessage = function (e) {};

Build: CONFIG_CLANG=y make qjs
Run: ./qjs --std test.js
Git version: d378a9f

Backtrace from the hang:

reni@fuzzer1:~/work/sut/quickjs $ lldb -- ./qjs --std test.js
(lldb) target create "./qjs"
Current executable set to '/home/reni/work/sut/quickjs/qjs' (x86_64).
(lldb) settings set -- target.run-args  "--std" "test.js"
(lldb) r
Process 3041495 launched: '/home/reni/work/sut/quickjs/qjs' (x86_64)
ReferenceError: could not load module filename 'nonexistent.js'

Process 3041495 stopped
* thread #1, name = 'qjs', stop reason = signal SIGSTOP
    frame #0: 0x00007ffff7da463d libc.so.6`__GI___select(nfds=6, readfds=0x00007fffffffd9e0, writefds=0x00007fffffffda70, exceptfds=0x0000000000000000, timeout=0x0000000000000000) at select.c:69:11
(lldb) bt
* thread #1, name = 'qjs', stop reason = signal SIGSTOP
  * frame #0: 0x00007ffff7da463d libc.so.6`__GI___select(nfds=6, readfds=0x00007fffffffd9e0, writefds=0x00007fffffffda70, exceptfds=0x0000000000000000, timeout=0x0000000000000000) at select.c:69:11
    frame #1: 0x000055555560a338 qjs`js_os_poll(ctx=0x0000555555667d60) at quickjs-libc.c:2368:11
    frame #2: 0x0000555555607332 qjs`js_std_loop(ctx=0x0000555555667d60) at quickjs-libc.c:3981:30
    frame #3: 0x00005555555673d5 qjs`main(argc=3, argv=0x00007fffffffdf08) at qjs.c:522:9
    frame #4: 0x00007ffff7cb2d90 libc.so.6`__libc_start_call_main(main=(qjs`main at qjs.c:300), argc=3, argv=0x00007fffffffdf08) at libc_start_call_main.h:58:16
    frame #5: 0x00007ffff7cb2e40 libc.so.6`__libc_start_main_impl(main=(qjs`main at qjs.c:300), argc=3, argv=0x00007fffffffdf08, init=<unavailable>, fini=<unavailable>, rtld_fini=<unavailable>, stack_end=0x00007fffffffdef8) at libc-start.c:392:3
    frame #6: 0x0000555555566805 qjs`_start + 37
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant