简体   繁体   English

Node.JS HTTPS问题TypeError:无法读取null的属性'writeQueueSize'

[英]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.

相关问题 MongoDB Node.js TypeError:无法读取 null 的属性“db” - MongoDB Node.js TypeError: Cannot read property 'db' of null 未捕获的TypeError:无法读取null Node.js的属性'getContext' - Uncaught TypeError: Cannot read property 'getContext' of null Node.js node.js/discord.js:类型错误:无法读取 null 的属性“setPresence” - node.js/discord.js: TypeError: Cannot read property 'setPresence' of null Node.js 在 Heroku 上部署失败:TypeError:无法读取 null 的属性“拆分” - Node.js deploy on Heroku fail : TypeError: Cannot read property 'split' of null 在 Node.js 中导出 ZCCADCDEDB567ABAE643E15DCF0974E503Z 方法(类型错误:无法读取 null 的属性“名称”) - Exporting Mongoose methods in Node.js (TypeError: Cannot read property 'name' of null) Node.js和jdbc:TypeError:无法读取undefined的属性'url' - Node.js and jdbc : TypeError: Cannot read property 'url' of undefined 类型错误:无法读取 Node.js 和 puppeteer 中未定义的属性“匹配” - TypeError: Cannot read property 'match' of undefined in Node.js and puppeteer Node.js和mongodb:TypeError:无法读取未定义的属性'findAll' - Node.js and mongodb: TypeError: Cannot read property 'findAll' of undefined “类型错误:无法读取未定义的属性‘状态’”node.js - "TypeError: Cannot read property 'status' of undefined" node.js TypeError:无法读取未定义的属性“getProperty”? Node.js,傀儡师 - TypeError: Cannot read property 'getProperty' of undefined? Node.js, Puppeteer
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM