nodejs / node

Node.js JavaScript runtime ✨🐢🚀✨

Home Page:https://nodejs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

http compat won't always call callback on end method

ronag opened this issue · comments

See, https://github.com/nodejs/node/blob/master/lib/internal/http2/compat.js#L651

  end(chunk, encoding, cb) {
    const stream = this[kStream];
    const state = this[kState];

    if ((state.closed || state.ending) &&
        state.headRequest === stream.headRequest) {
      return this;
    }
    ...

This code will never call cb (inside the condition) causing a potential deadlock.