undici icon indicating copy to clipboard operation
undici copied to clipboard

`assert(!this.aborted)` triggers sporadically when `allowH2` is set to `true`

Open steveluscher opened this issue 4 months ago • 4 comments

Bug Description

Under load, when used with an Agent dispatcher having allowH2 set to true, fetch will sporadically throw an ERR_ASSERTION.

Reproducible By

Click ‘fork and run’ here: https://replit.com/@StevenLuscher/DarkredIroncladMethods

Expected Behavior

If the problem is that the underlying request is failing, I would expect it to trigger the catch block. Otherwise, we may be looking at a bug with the http/2 implementation itself.

Logs & Screenshots

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

  assert(!this.aborted)

    at Request.onHeaders (/home/runner/DarkredIroncladMethods/node_modules/undici/lib/core/request.js:245:5)
    at ClientHttp2Stream.<anonymous> (/home/runner/DarkredIroncladMethods/node_modules/undici/lib/client.js:1793:17)
    at Object.onceWrapper (node:events:629:26)
    at ClientHttp2Stream.emit (node:events:514:28)
    at emit (node:internal/http2/core:331:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:85:22) {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: false,
  expected: true,
  operator: '=='
}

Environment

  • Node.js v20.10.0
  • Linux baa638bf460f 6.5.0-1013-gcp #⁠13~22.04.1-Ubuntu SMP Wed Jan 24 23:39:40 UTC 2024 x86_64 GNU/Linux
  • undici 6.2.2

steveluscher avatar Feb 22 '24 08:02 steveluscher