[英]Node.JS HTTPS issue TypeError: Cannot read property 'writeQueueSize' of null
I have a Node.JS HTTPS server and I'm getting randomly the following error 我有一个Node.JS HTTPS服务器,并且随机出现以下错误
net.js:729
if (req.async && this._handle.writeQueueSize != 0)
^
TypeError: Cannot read property 'writeQueueSize' of null
at TLSSocket.Socket._writeGeneric (net.js:729:32)
at TLSSocket.Socket._writev (net.js:737:8)
at doWrite (_stream_writable.js:327:12)
at clearBuffer (_stream_writable.js:416:5)
at onwrite (_stream_writable.js:368:7)
at WriteWrap.afterWrite [as oncomplete] (net.js:824:12)
Worker 33233 died -> 33245 born.
I'm using multidomain in the HTTPS, but there isn't a special trigger for this issue, I just see it in the logs randomly. 我在HTTPS中使用多域,但没有针对此问题的特殊触发器,我只是在日志中随机看到它。
try {
var options = {
SNICallback: function (domain, cb) {
if (!secureContext[domain]) {
domain = 'default';
}
cb(null, tls.createSecureContext(secureContext[domain]));
},
key: secureContext['default'].key,
cert: secureContext['default'].cert,
};
global.serverHTTPS = https.createServer(options, app);
} catch (err){
console.error(err.message);
console.error(err.stack);
}
global.serverHTTPS.on('connection', onConnection);
global.serverHTTPS.on('error', onError);
global.serverHTTPS.listen(global.config.httpsPort);
I have recently fixed the same bug. 我最近修复了相同的错误。 Issue was caused by destroying net.Socket in tls.Server instance.
问题是由于破坏tls.Server实例中的net.Socket引起的。 So if you need to destroy a secure connection you should listen
secureConnection
event . 因此,如果您需要破坏安全连接,则应该监听
secureConnection
事件 。
try {
var options = {
SNICallback: function (domain, cb) {
if (!secureContext[domain]) {
domain = 'default';
}
cb(null, tls.createSecureContext(secureContext[domain]));
},
key: secureContext['default'].key,
cert: secureContext['default'].cert,
};
global.serverHTTPS = https.createServer(options, app);
} catch (err){
console.error(err.message);
console.error(err.stack);
}
global.serverHTTPS.on('secureConnection', onConnection);
global.serverHTTPS.on('error', onError);
global.serverHTTPS.listen(global.config.httpsPort);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.