http2: close not emitted when receiving RST_STREAM after DATA

  • Version: latest master
  • Platform: Linux 4.4.0-142-generic 168-Ubuntu SMP Wed Jan 16 2019 x86_64 GNU/Linux
  • Subsystem: http2
const server = http2.createServer();
server.on('stream', (stream) => {
  stream.respond();
  stream.write('test');
  // Wait for DATA to be sent, then send RST_STREAM
  setTimeout(() => stream.close(), 200);
});

server.listen(() => {
  const client = http2.connect({ protocol: 'http:', ...server.address() });
  const req = client.request({ ':path': '/' });
  req.end();
  req.on('close', () => {
    // Never called
  });
});

I can verify that RST_STREAM is sent to the client, but close is never emitted. Is this expected?
If the write is removed, close is emitted.