Sitelet https://github.com/nodejs/node/issues/48180
Skip to content

Flaky js-native-api/test_cannot_run_js/test #48180

Description

@kvakil

Test

js-native-api/test_cannot_run_js/test

Platform

Linux ARM64, Linux x64, macOS ARM64, macOS x64

Console output

crashed (-6)
---
duration_ms: 509.947
exitcode: -6
severity: crashed
...

Build links

See reliability report: nodejs/reliability#576

Here's one example: https://ci.nodejs.org/job/node-test-binary-armv7l/5897/RUN_SUBSET=native,nodes=ubuntu2004-armv7l/testReport/junit/js-native-api/test_cannot_run_js/test/

Additional information

Newly added in #47986

Probably comes from this abort statement:

Could not reproduce locally with test.py. Weirdly it reproduces every time when run without test.py:

./node test/js-native-api/test_cannot_run_js/test.js 

Activity

  1. added
    flaky-testIssues and PRs involving tests that fail intermittently in CI.
    on May 25, 2023
  2. added
    linuxIssues and PRs related to the Linux platform.
    macosIssues and PRs related to the macOS platform.
    on May 25, 2023
  3. added a commit that references this issue on May 30, 2023
  4. added a commit that references this issue on Jul 6, 2023
  5. richardlau commented on Feb 26, 2024

    @richardlau
    Member

    This issue should not have been closed -- #48181 merely marked the test as flaky.

  6. abmusse commented on Feb 27, 2024

    @abmusse
    Contributor

    I've added a log to check what the actual and expected values are before we abort.

    This was done on IBM i:

    if (napi_get_global(env, &global) != napi_ok) abort();
    if (napi_get_named_property(env, global, "setTimeout", &set_timeout) !=
    expected_status)
    abort();
    free(ref);

    diff --git a/test/js-native-api/test_cannot_run_js/test_cannot_run_js.c b/test/js-native-api/test_cannot_run_js/test_cannot_run_js.c
    index c495f8780d..3ed3ee97fb 100644
    --- a/test/js-native-api/test_cannot_run_js/test_cannot_run_js.c
    +++ b/test/js-native-api/test_cannot_run_js/test_cannot_run_js.c
    @@ -14,9 +14,12 @@ static void Finalize(napi_env env, void* data, void* hint) {
     
       if (napi_delete_reference(env, *ref) != napi_ok) abort();
       if (napi_get_global(env, &global) != napi_ok) abort();
    -  if (napi_get_named_property(env, global, "setTimeout", &set_timeout) !=
    -      expected_status)
    +
    +  napi_status actual_status = napi_get_named_property(env, global, "setTimeout", &set_timeout);
    +  if (actual_status != expected_status){
    +    fprintf(stderr, "actual_status (%d) != expected_status(%d)\n", actual_status, expected_status);
         abort();
    +  }
       free(ref);
     }
    $ ./out/Release/node test/js-native-api/test_cannot_run_js/test.js 
    actual_status (0) != expected_status(10)
    IOT/Abort trap (core dumped)

    Looks like the actual napi_status value is 0 but the expected status is 10. 🤔

    From the docs napi_status is a enum an 0 should map to -> napi_ok and 10 would map to -> napi_pending_exception

    ref: https://nodejs.org/api/n-api.html#napi_status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    flaky-testIssues and PRs involving tests that fail intermittently in CI.linuxIssues and PRs related to the Linux platform.macosIssues and PRs related to the macOS platform.node-apiIssues and PRs related to Node-API.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions