jerryscript icon indicating copy to clipboard operation
jerryscript copied to clipboard

Assertion 'context_p->token.type != LEXER_RIGHT_PAREN' failed in parser_parse_while_statement_start

Open renatahodovan opened this issue 11 months ago • 37 comments

JerryScript revision

50200152 (v3.0.0)

Build platform

Ubuntu 24.04.1 LTS (Linux 6.8.0-49-generic x86_64)

Build steps
./tools/build.py --clean --debug --compile-flag=-fsanitize=address --logging=on
Test case
while (class {
   #delete;
}) continue;
Output
ICE: Assertion 'context_p->token.type != LEXER_RIGHT_PAREN' failed at jerryscript/src/jerry-core/parser/js/js-parser-statm.c(parser_parse_while_statement_start):973.
Error: JERRY_FATAL_FAILED_ASSERTION
==1908899== ERROR: libFuzzer: deadly signal
    #0 0x557fbbefb545 in __sanitizer_print_stack_trace (jerryscript/basic/libfuzzer+0x1e9545) (BuildId: 932bc76ab7f7477eee554362851f38adbd14aaa0)
    #1 0x557fbbe4f48c in fuzzer::PrintStackTrace() (jerryscript/basic/libfuzzer+0x13d48c) (BuildId: 932bc76ab7f7477eee554362851f38adbd14aaa0)
    #2 0x557fbbe345f7 in fuzzer::Fuzzer::CrashCallback() (jerryscript/basic/libfuzzer+0x1225f7) (BuildId: 932bc76ab7f7477eee554362851f38adbd14aaa0)
    #3 0x7f1c9064532f  (/lib/x86_64-linux-gnu/libc.so.6+0x4532f) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #4 0x7f1c9069eb2b in pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2b) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #5 0x7f1c9064527d in raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527d) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #6 0x7f1c906288fe in abort (/lib/x86_64-linux-gnu/libc.so.6+0x288fe) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #7 0x557fbc0b3a00 in jerry_port_fatal jerryscript/src/jerry-port/common/jerry-port-process.c:41:5
    #8 0x557fbc0186cd in jerry_fatal jerryscript/src/jerry-core/jrt/jrt-fatals.c:63:3
    #9 0x557fbc01878e in jerry_assert_fail jerryscript/src/jerry-core/jrt/jrt-fatals.c:83:3
    #10 0x557fbc0576bc in parser_parse_while_statement_start jerryscript/src/jerry-core/parser/js/js-parser-statm.c:973:5
    #11 0x557fbc0576bc in parser_parse_statements jerryscript/src/jerry-core/parser/js/js-parser-statm.c:2845:9
    #12 0x557fbc05e2ab in parser_parse_source jerryscript/src/jerry-core/parser/js/js-parser.c:2280:5
    #13 0x557fbc066499 in parser_parse_script jerryscript/src/jerry-core/parser/js/js-parser.c:3332:38
    #14 0x557fbbf461d0 in jerry_parse_common jerryscript/src/jerry-core/api/jerryscript.c:413:21
    #15 0x557fbbf46604 in jerry_parse jerryscript/src/jerry-core/api/jerryscript.c:481:10
    #16 0x557fbbf31475 in LLVMFuzzerTestOneInput jerryscript/src/jerry-main/main-libfuzzer.c:30:33
    #17 0x557fbbe35bca in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (jerryscript/basic/libfuzzer+0x123bca) (BuildId: 932bc76ab7f7477eee554362851f38adbd14aaa0)
    #18 0x557fbbe1d863 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) (jerryscript/basic/libfuzzer+0x10b863) (BuildId: 932bc76ab7f7477eee554362851f38adbd14aaa0)
    #19 0x557fbbe23a21 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (jerryscript/basic/libfuzzer+0x111a21) (BuildId: 932bc76ab7f7477eee554362851f38adbd14aaa0)
    #20 0x557fbbe4fff6 in main (jerryscript/basic/libfuzzer+0x13dff6) (BuildId: 932bc76ab7f7477eee554362851f38adbd14aaa0)
    #21 0x7f1c9062a1c9  (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #22 0x7f1c9062a28a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    #23 0x557fbbe17ff4 in _start (jerryscript/basic/libfuzzer+0x105ff4) (BuildId: 932bc76ab7f7477eee554362851f38adbd14aaa0)

renatahodovan avatar Mar 01 '25 18:03 renatahodovan

Is there an automatic formatting tool for lint?

coder2z avatar Jun 10 '25 10:06 coder2z

I tried to fix the lint, please rerun the pipeline.

coder2z avatar Jun 10 '25 11:06 coder2z

I tried to fix the lint, please rerun the pipeline.

coder2z avatar Jun 13 '25 06:06 coder2z

I'll handle it over the weekend.

coder2z avatar Jun 17 '25 06:06 coder2z

I tried to fix, please rerun the pipeline.

coder2z avatar Jun 20 '25 09:06 coder2z

I encountered some problems while fixing unit tests, which I find difficult to solve. Could you help me check the reason, and how can I run unit test files locally using docker?

coder2z avatar Jun 22 '25 10:06 coder2z

I encountered some problems while fixing unit tests, which I find difficult to solve. Could you help me check the reason, and how can I run unit test files locally using docker?

You can refer to https://github.com/apache/apisix/blob/master/docs/en/latest/build-apisix-dev-environment-devcontainers.md

Baoyuantop avatar Jun 23 '25 06:06 Baoyuantop

Hi @coder2z, any updates?

Baoyuantop avatar Jul 03 '25 02:07 Baoyuantop

Hi @coder2z, I will convert this pr to draft. If you have time to deal with it, please let me know.

Baoyuantop avatar Jul 28 '25 07:07 Baoyuantop

I encountered some problems while fixing unit tests, which I find difficult to solve. Could you help me check the reason, and how can I run unit test files locally using docker?我在修复单元测试时遇到了一些问题,我发现很难解决。你能帮我检查一下原因,以及如何使用 docker 在本地运行单元测试文件?

You can refer to https://github.com/apache/apisix/blob/master/docs/en/latest/build-apisix-dev-environment-devcontainers.md可以参考 https://github.com/apache/apisix/blob/master/docs/en/latest/build-apisix-dev-environment-devcontainers.md

According to the document, the following error occurs, @Baoyuantop

root@f7093cffb2ed:/workspace# make run
[ info ] run -> [ Start ]
/workspace/bin/apisix start
/usr/local/openresty//luajit/bin/luajit ./apisix/cli/apisix.lua start
nginx.pid exists but there's no corresponding process with pid  21156   , the file will be overwritten
trying to initialize the data of etcd
nginx: [emerg] bind() to unix:/workspace/logs/worker_events.sock failed (98: Address already in use)
nginx: [emerg] bind() to unix:/workspace/logs/worker_events.sock failed (98: Address already in use)
nginx: [emerg] bind() to unix:/workspace/logs/worker_events.sock failed (98: Address already in use)
nginx: [emerg] bind() to unix:/workspace/logs/worker_events.sock failed (98: Address already in use)
nginx: [emerg] bind() to unix:/workspace/logs/worker_events.sock failed (98: Address already in use)
nginx: [emerg] still could not bind()
[ info ] run -> [ Done ]
root@f7093cffb2ed:/workspace# nginx -v
bash: nginx: command not found
root@f7093cffb2ed:/workspace# FLUSH_ETCD=1 prove -Itest-nginx/lib -I. -r t/node/least_conn.t
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
t/node/least_conn.t .. perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Use of uninitialized value $version in pattern match (m//) at /workspace/t/APISIX.pm line 147.
Use of uninitialized value $version in pattern match (m//) at /workspace/t/APISIX.pm line 196.
Use of uninitialized value $version in pattern match (m//) at /workspace/t/APISIX.pm line 228.
Use of uninitialized value $version in pattern match (m//) at /workspace/t/APISIX.pm line 237.
Bailout called.  Further testing stopped:  Failed to get the version of the Nginx in PATH:
t/node/least_conn.t .. skipped: (no reason given)

Test Summary Report
-------------------
t/node/least_conn.t (Wstat: 65280 (exited 255) Tests: 0 Failed: 0)
  Non-zero exit status: 255
Files=1, Tests=0,  1 wallclock secs ( 0.02 usr  0.00 sys +  0.19 cusr  0.12 csys =  0.33 CPU)
Result: FAIL
FAILED--Further testing stopped: Failed to get the version of the Nginx in PATH:
root@f7093cffb2ed:/workspace# git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   .devcontainer/devcontainer.json
        modified:   conf/config.yaml

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        test-nginx/

no changes added to commit (use "git add" and/or "git commit -a")

coder2z avatar Aug 07 '25 16:08 coder2z

@coder2z Hello, some tests might not pass in docker (dev container), which is determined by the dependencies of these tests themselves.

When encountering these problems, it is recommended to move directly in the host.

SkyeYoung avatar Aug 08 '25 00:08 SkyeYoung

@coder2z Hello, some tests might not pass in docker (dev container), which is determined by the dependencies of these tests themselves.您好,某些测试可能无法在 docker(开发容器)中通过,这是由这些测试本身的依赖关系决定的。

When encountering these problems, it is recommended to move directly in the host.遇到这些问题时,建议直接在主机中移动。

Is there any documentation? @SkyeYoung liunx or win

coder2z avatar Aug 08 '25 02:08 coder2z

@coder2z I'm used to checking these below

  • https://github.com/apache/apisix/blob/master/.github/workflows/build.yml
  • https://apisix.apache.org/docs/apisix/building-apisix/#troubleshooting
  • https://metacpan.org/pod/Test::Nginx::Socket

SkyeYoung avatar Aug 08 '25 02:08 SkyeYoung

@Baoyuantop Please try again

coder2z avatar Aug 26 '25 10:08 coder2z

failed pipeline. It seems that the docker image cannot be pulled? Is it a pipeline problem?

coder2z avatar Aug 27 '25 01:08 coder2z

I triggered the re-run.

Baoyuantop avatar Aug 27 '25 02:08 Baoyuantop

Maybe it's OK now, I'll test it locally

coder2z avatar Aug 27 '25 08:08 coder2z

fix lint done

coder2z avatar Aug 28 '25 08:08 coder2z

fix lint done

coder2z avatar Aug 29 '25 02:08 coder2z

t/plugin/sls-logger.t I haven't modified it, so why did it fail?

coder2z avatar Aug 29 '25 03:08 coder2z

image

coder2z avatar Aug 29 '25 03:08 coder2z

@Baoyuantop help take a look

coder2z avatar Sep 01 '25 02:09 coder2z

I don't see any reason, could you merge the master branch and try again?

Baoyuantop avatar Sep 01 '25 02:09 Baoyuantop

I don't see any reason, could you merge the master branch and try again?我看不出任何理由,你能合并 master 分支并重试吗?

done

coder2z avatar Sep 03 '25 10:09 coder2z

image

Local is completely OK, and other pipelines are also OK. Is this more special? What is the difference?

coder2z avatar Sep 04 '25 06:09 coder2z

Hi @coder2z, You can check if there are any inconsistencies in your environment according to the CI file.

Baoyuantop avatar Sep 05 '25 02:09 Baoyuantop

@Baoyuantop Please try again

coder2z avatar Oct 09 '25 09:10 coder2z

@Baoyuantop Please try again

coder2z avatar Oct 10 '25 09:10 coder2z

fix lint

coder2z avatar Oct 11 '25 09:10 coder2z

I looked at the differences between the two test cases:

export TEST_EVENTS_MODULE=lua-resty-events
export TEST_EVENTS_MODULE=lua-resty-worker-events

However, both of these worked fine in my local tests, and the unit tests all passed, I carefully examined the failed cases and suspect it might be due to concurrent execution of unit tests, which led to incomplete cleanup of etcd data causing data conflicts.

I’m not sure if my understanding is correct? Please help me check the reason.

coder2z avatar Oct 13 '25 08:10 coder2z