-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
common.socket->onData error #17
Comments
@nagisa3000 我看看本地能不能复现,你用的机器是 Windows 还是 Mac / Linux 呢,而且这个是偶尔会还是很大概率能复现的呢?我在本地似乎没办法复现这个错误 感谢提供错误信息,如果有更多的错误信息可以在这里回复~ |
@hyj1991 我用的是64位Win7 在我的机子上是必现的错误。 |
@nagisa3000 我刚才找了台 Win7 64 位的测试了一下,跑了几次 MEM 检测都没有问题哇 这样子,你打开 node_modules/easy-monitor/src_logic/common/common.socket.js 文件,修改此文件的 105 行,将原本的: returnMsg.then(r => r && common.socket.sendMessage(socket, r)).catch(e => dbl.error(`common.socket->onData error: ${e}`)); 改为: returnMsg.then(r => r && common.socket.sendMessage(socket, r)).catch(e => dbl.error(`common.socket->onData error: ${e.stack}`)); 然后重启你的项目,再测试一遍,把得到的错误详细栈信息复制到这边,我看下 |
[Easy-Monitor: dashboard <7664>] http_server start at 12333... @hyj1991 错误信息如上 顺带我用的node版本是6.2.0 |
@nagisa3000 好的,这是比较关键的信息,我先下载 Node 6.2 看看能不能复现 |
@nagisa3000
Node v6.4.0 之前的 options.stdio = options.silent ? ['pipe', 'pipe', 'pipe', 'ipc'] :
[0, 1, 2, 'ipc']; 从 v6.4.0 开始后支持配置 stdio 参数, if (!Array.isArray(options.stdio)) {
// Leave stdin open for the IPC channel. stdout and stderr should be the
// same as the parent's if silent isn't set.
options.stdio = options.silent ? ['pipe', 'pipe', 'pipe', 'ipc'] :
[0, 1, 2, 'ipc'];
} else if (options.stdio.indexOf('ipc') === -1) {
throw new TypeError('Forked processes must have an IPC channel');
} 而在 Easy-Monitor v2.1.2 中开启子进程进行负载的逻辑计算,因为只使用到了 stdin 流传输数据,所以仅设置了 stdin 流为管道类型: function fork(cpath, params) {
//取出公共部分
const config = this.config;
const common = this.common;
const dbl = this.dbl;
//fork 进程,stdio 设置子进程的 stdin 为 pipe 备用传输数据,其余默认
params = typeof params === 'string' && params || params && JSON.stringify(params) || '';
const ps = cp.fork(cpath, [params], { stdio: ['pipe', 1, 2, 'ipc'], silent: false, execArgv: [] });
//设置子进程内部方法
ps.innerSend = _innerSend;
return ps;
} 这部分代码显然在 Node v6.4.0 之前时 stdio 参数设置无法生效,所以会报这个错误。 临时解决方案: 更改 node_modules/easy-monitor/src_logic/common/common.calculate.js 的 38 行,将原本的: const ps = cp.fork(cpath, [params], { stdio: ['pipe', 1, 2, 'ipc'], silent: false, execArgv: [] }); 更改为: const ps = cp.fork(cpath, [params], { stdio: ['pipe', 1, 2, 'ipc'], silent: true, execArgv: [] }); 这样可以临时解决这个问题,我再看看怎么做更加理想的兼容方式,预计下个版本合并解决这个问题。 参考列表: |
@hyj1991 修改后可以正常执行了。十分感谢~ |
@nagisa3000 好的,不客气,感谢提供有用的信息反馈 |
Hi,这个问题已经修复: commit#f00c00421cf5bb6421730fcfd41a1cbf443a94c4 下个版本合并 |
@hyj1991 嗯嗯好的 |
@ nagisa3000 暂时没有这个计划,因为这个版本太古老了,在 IO.js 分裂之前了
2017-07-05 10:39 GMT+08:00 nagisa3000 <notifications@github.com>:
… @hyj1991 <https://github.com/hyj1991> 还有一个问题,支持node 0.10.xx版本吗
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#17 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AS_G6pTe1VMc_gqPt4qvQzFW7Gjdb0csks5sKvdpgaJpZM4OM3IB>
.
|
@hyj1991 嗯嗯 确实太古老了 |
用MEM检查内存的时候,浏览器会卡在“Memory Stream 准备完毕,即将开启子进程进行流式读取,此过程较慢,请耐心等待...”,cmd报错common.socket->onData error: TypeError: Cannot read property 'on' of null。
请问这个问题该怎么排查。
The text was updated successfully, but these errors were encountered: