Bug 1743558

Summary: SPDY fails in node v12
Product: Red Hat Enterprise Linux 8 Reporter: Anna Khaitovich <akhaitov>
Component: nodejs-12-moduleAssignee: Zuzana Svetlikova <zsvetlik>
Status: CLOSED NOTABUG QA Contact: Jan Houska <jhouska>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.1CC: jhouska, zsvetlik
Target Milestone: rcKeywords: Reopened
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1762839 1875738 1885872 1896454 1929312 (view as bug list) Environment:
Last Closed: 2021-04-14 12:19:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1762839, 1875738, 1885872, 1896454, 1896876, 1929312    

Description Anna Khaitovich 2019-08-20 08:27:56 UTC
Description of problem:
Refer to this issue [1] for more info.

[1] https://github.com/spdy-http2/node-spdy/issues/350

Version-Release number of selected component (if applicable):
nodejs-12.4.0-1.module+el8.1.0+3505+d278616f.x86_64

How reproducible:
Always

Steps to Reproduce:
$ rpm -qa nodejs
nodejs-12.4.0-1.module+el8.1.0+3505+d278616f.x86_64

$ npm list
/mnt/tests/CoreOS/nodejs/Sanity/spdy-smoke
└─┬ spdy.1 -> /usr/lib/node_modules/spdy
  ├── debug.1 extraneous
  ├── handle-thing.0 extraneous
  ├── http-deceiver.7 extraneous
  ├── select-hose.0 extraneous
  └── spdy-transport.0 extraneous

$ cat server.js
var spdy = require('spdy'),
    fs = require('fs');

var options = {
  key: fs.readFileSync('./server-key.pem'),
  cert: fs.readFileSync('./server-cert.pem'),

  windowSize: 1024, // Server's window size
};

var server = spdy.createServer(options, function(req, res) {
  res.writeHead(200);

  var is_spdy = "false"
  if (req.isSpdy) { is_spdy = req.isSpdy.toString() }
  console.log("isSpdy: " + is_spdy);

  res.end('ok');
});

server.listen(8000);

$ cat client.js
var spdy = require('spdy'),
    http = require('http'),
    assert = require('assert');

process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

var port = 8000;

var agent = spdy.createAgent({
  host: 'localhost',
  port: port
});

http.get({
  protocol: 'https:',
  host: 'localhost',
  path: '/',
  port: port,
  agent: agent
}, function(response) {
  assert.equal(response.statusCode, 200);
  response.on('data', function(data) {
    assert.equal(data.toString(), 'ok');
    agent.close();
    process.exit(0);
  });
}).end();

$ nohup node server.js &
$ node client.js
(node:22072) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(node:22072) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
events.js:177
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:183:27)
Emitted 'error' event at:
    at Connection.<anonymous> (/usr/lib/node_modules/spdy/lib/spdy/agent.js:149:12)
    at Connection.emit (events.js:200:13)
    at TLSSocket.onSocketError (/usr/lib/node_modules/spdy/node_modules/spdy-transport/lib/spdy-transport/connection.js:176:10)
    at TLSSocket.emit (events.js:205:15)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:9) {
  errno: 'ECONNRESET',
  code: 'ECONNRESET',
  syscall: 'read'
}
[1]+  Exit 1                  nohup node server.js

Actual results:
$ cat nohup.out 
isSpdy: true
(node:11783) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
internal/buffer.js:941
class FastBuffer extends Uint8Array {}
^

RangeError: Invalid typed array length: -4095
    at new Uint8Array (<anonymous>)
    at new FastBuffer (internal/buffer.js:941:1)
    at Handle.onStreamRead [as onread] (internal/stream_base_commons.js:165:17)
    at Stream.<anonymous> (/usr/lib/node_modules/spdy/node_modules/handle-thing/lib/handle.js:88:10)
    at Stream.emit (events.js:205:15)
    at endReadableNT (/usr/lib/node_modules/spdy/node_modules/readable-stream/lib/_stream_readable.js:1077:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:9)


Expected results:
Request is served successfully

Additional info:
It is possible to work this around using the workaround mentioned in the issue [1]. After I've made changes to node_modules/spdy/node_modules/handle-thing/lib/handle.js file, the error's disappeared:

88 - self.onread(uv.UV_EOF, Buffer.alloc(0))
88 + self.onread(Buffer.alloc(0))

94 - self.onread(uv.UV_ECONNRESET, Buffer.alloc(0))
94 + self.onread(Buffer.alloc(0))

Comment 5 RHEL Program Management 2021-02-20 07:29:23 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.

Comment 8 Jan Houska 2021-04-01 16:14:29 UTC
I am reopening this.  It is still the issue.

Comment 11 Jan Houska 2021-04-14 12:19:54 UTC
Proposing to close - the problem was solved by update nodejs-spdy module to 4.0.2 version.  Test was fixed accordingly and it was added to the tier1 testing.