Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

http2 stream.end error #36860

Open
ariran5 opened this issue Jan 10, 2021 · 8 comments
Open

http2 stream.end error #36860

ariran5 opened this issue Jan 10, 2021 · 8 comments
Labels
http2 Issues or PRs related to the http2 subsystem.

Comments

@ariran5
Copy link

ariran5 commented Jan 10, 2021

  • Version: 15.5.1
  • Platform: Darwin MacBook-Pro.local 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64

What steps will reproduce the bug?

// index.mjs

import http2 from 'http2'
import fs from 'fs'

const server = http2.createSecureServer({
  key: fs.readFileSync('localhost-privkey.pem'),
  cert: fs.readFileSync('localhost-cert.pem')
})

server.on('error', (err) => console.error(err))

server.on('stream', (stream, headers, flags) => {
  stream.end('qweqwe ds sdoapskd okqdoeik woik ed'.repeat(80), err => {
    if (err) {
      console.error(err) // always shows error on each request
      return
    }
    console.log('qweqwe')
  })
});

server.listen(8444) // https://localhost:8444
Error [ERR_STREAM_DESTROYED]: Cannot call end after a stream was destroyed
    at new NodeError (node:internal/errors:278:15)
    at errorBuffer (node:internal/streams/writable:527:14)
    at afterWrite (node:internal/streams/writable:507:5)
    at onwrite (node:internal/streams/writable:483:7)
    at done (node:internal/http2/core:2081:7)
    at WriteWrap.writeCallback [as callback] (node:internal/http2/core:2086:7)
    at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:89:12) {
  code: 'ERR_STREAM_DESTROYED'
}

What is the expected behavior?

Works without errors

What do you see instead?

Always shows errors on each response in stream.end callback

@PoojaDurgad PoojaDurgad added the http2 Issues or PRs related to the http2 subsystem. label Jan 11, 2021
@kingyyy
Copy link

kingyyy commented Mar 24, 2021

same here

@Ayase-252
Copy link
Member

Ayase-252 commented Mar 24, 2021

Reproducable in Node v15.12.0. Also Reproducable in v15.0.0

➜  node git:(triaging/issue-37866) ✗ node -v
v15.12.0
➜  node git:(triaging/issue-37866) ✗ node issues/http2-36860.mjs 
Error [ERR_STREAM_DESTROYED]: Cannot call end after a stream was destroyed
    at new NodeError (node:internal/errors:329:5)
    at errorBuffer (node:internal/streams/writable:527:14)
    at afterWrite (node:internal/streams/writable:507:5)
    at onwrite (node:internal/streams/writable:483:7)
    at done (node:internal/http2/core:2087:7)
    at WriteWrap.writeCallback [as callback] (node:internal/http2/core:2092:7)
    at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:87:12) {
  code: 'ERR_STREAM_DESTROYED'
}
Error [ERR_STREAM_DESTROYED]: Cannot call end after a stream was destroyed
    at new NodeError (node:internal/errors:329:5)
    at errorBuffer (node:internal/streams/writable:527:14)
    at afterWrite (node:internal/streams/writable:507:5)
    at onwrite (node:internal/streams/writable:483:7)
    at done (node:internal/http2/core:2087:7)
    at WriteWrap.writeCallback [as callback] (node:internal/http2/core:2092:7)
    at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:87:12) {
  code: 'ERR_STREAM_DESTROYED'
}

But it works without issue in v14.15.5 and v14.16.0.

EDIT: delete duplicated comment due to bad connection

@Kalmuraee
Copy link

I have the same issue, I was assuming updating to 15.14.0 would solve the issue, but it didn't.

@acolle
Copy link

acolle commented Apr 24, 2021

Any updates on that one?
I'm having the same issue on 15.9.0.
Thanks

@valipopescu
Copy link

I have the same issue in 16.2.

@Ayase-252
Copy link
Member

cc @nodejs/http2

@bl-ue
Copy link
Contributor

bl-ue commented Jun 8, 2021

If this is a bug, I'll try to open a PR to fix it.

@bl-ue
Copy link
Contributor

bl-ue commented Jun 8, 2021

Reproducible in master (65a7fd3).
There were a few semver-major http2-related PRs shipped with v15, #34664, #33161, #33535, #33193, and a few http-related semver-major PRs #33405, #33172, #31818. I'll bisect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http2 Issues or PRs related to the http2 subsystem.
Projects
None yet
Development

No branches or pull requests

8 participants