简体   繁体   English

Child_process fork-间歇性读错误

[英]Child_process fork - intermittent onread error

I'm trying to create a caching server in node using child_process.fork. 我正在尝试使用child_process.fork在节点中创建缓存服务器。

The basic idea is that there's a dispatching server that will spawn off forked “caching servers” based on the incoming URI. 基本思想是有一个调度服务器,它将基于传入的URI派生出派生的“缓存服务器”。 Once the caching servers are forked, the client sockets are sent to their appropriate forked caching server via the fork's .send method. 一旦缓存服务器被派生,客户端套接字就会通过fork的.send方法发送到其相应的派生缓存服务器。

cacheServers[this.key] = require('child_process').fork(‘CacheServer.js’,[this.key]);

... and then ... 接着

cacheServers[subKey].send(“client”,clientSocket);

At times sending the client (and its socket) to a fork works fine, and at other times it throws an error: 有时将客户端(及其套接字)发送到派生服务器可以正常工作,有时则抛出错误:

TypeError: Cannot set property 'onread' of null
at ChildProcess.handleConversion.net.Socket.send (child_process.js:134:21)
at ChildProcess.target.send (child_process.js:439:52)
at Server.server.Subscribe(/home/devuser/CachingServer/CachingServer.js:104:23)
at ChildProcess.<anonymous> (/home/devuser/CachingServer/CachingServer.js:145:10)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at handleMessage (child_process.js:318:10)
at Pipe.channel.onread (child_process.js:345:11)

There seems to be no difference in the clients I'm sending to the fork. 我发送到分叉的客户端似乎没有什么区别。

Anyone out there have any clue at all? 外面有任何线索吗?

Looks like it has been fixed in v0.11.13 and v0.10.27? 看起来它已经在v0.11.13和v0.10.27中修复了?

Issue #5469 , Fix , Test 问题#5469修复测试

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM