Skip to content

test/async-hooks/test-callback-error.js always produces core file #29286

Closed
@trevnorris

Description

@trevnorris
  • Version: master (f39ad8a), v12.x (b4e670d) back to v12.0.0
  • Platform: All
  • Subsystem: async_hooks, test

The test test/async-hooks/test-callback-error.js always produces a core file when run.

Example reproduction:

$ ls core
ls: cannot access 'core': No such file or directory
$ ./node test/async-hooks/test-callback-error.js
start case 1
end case 1: 74.522ms
start case 2
end case 2: 79.682ms
start case 3
end case 3: 9.263ms
$ ls core
core

Expected: Successful tests should not produce core files.

The issue comes from case 3 above, which runs:

$ ./node test/async-hooks/test-callback-error.js --abort-on-uncaught-exception test_callback_abort

The problem is test_callback_abort always has an uncaught exception. Here I've changed the test to always print the output from case 3 child's stderr:

$ ./node test/async-hooks/test-callback-error.js
start case 1
end case 1: 51.322ms
start case 2
end case 2: 47.906ms
start case 3
end case 3: 12.985ms
Error: test_callback_abort
    at ActivityCollector.<anonymous> (node/test/async-hooks/test-callback-error.js:27:45)
    at ActivityCollector.oninit node/test/common/index.js:373:15)
    at ActivityCollector._init (node/test/async-hooks/init-hooks.js:192:10)
    at emitInitNative (internal/async_hooks.js:134:43)
    at emitInitScript (internal/async_hooks.js:341:3)
    at new AsyncResource (async_hooks.js:156:7)
    at Object.<anonymous> (node/test/async-hooks/test-callback-error.js:29:5)
    at Module._compile (internal/modules/cjs/loader.js:936:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
    at Module.load (internal/modules/cjs/loader.js:790:32)
 1: 0x9837a0 node::Abort() [node]
 2: 0x9edaf9  [node]
 3: 0xb129ad v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/usr/local/bin/node]
 4: 0xb120bb  [node]
 5: 0xb117ed  [node]
 6: 0x123c579  [node]

(note: the above output is from v12.9.0)

Even though, ironically, running the test directly doesn't cause the core file:

$ ./node test/async-hooks/test-callback-error.js --abort-on-uncaught-exception test_callback_abort
assert.js:373
    throw err;
    ^

AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

  assert.ok(!arg)

    at Object.<anonymous> (node/test/async-hooks/test-callback-error.js:34:8)
    at Module._compile (internal/modules/cjs/loader.js:936:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
    at Module.load (internal/modules/cjs/loader.js:790:32)
    at Function.Module._load (internal/modules/cjs/loader.js:703:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:999:10)
    at internal/main/run_main_module.js:17:11 {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: false,
  expected: true,
  operator: '=='
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    async_hooksIssues and PRs related to the async hooks subsystem.linuxIssues and PRs related to the Linux platform.testIssues and PRs related to the tests.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions