子プロセスでprocess.sendを使用しているときにように私は、エラーを取得しています。エラーがあるノード:child_process.js:427 throw new TypeError( "このハンドルタイプは送信できません");
var child = require('child_process');
var forkedProcess = child.fork(nodeScriptFile);
:
child_process.js:427
throw new TypeError("This handle type can't be sent");
^
TypeError: This handle type can't be sent
のように
process.send(someObject, function() {
....
});
子プロセスが作成されます
プログラムは1台のサーバーで正常に動作します。すべてのファイルをコピーして別のプロダクションサーバーを作成しようとしましたが、このエラーが発生しました。もちろん、プログラムにはさらに多くのものがあり、上に示したコードがあります。 私はいくつかのインストールや何かを見落としていると感じます。私は子供-process.jsコードを見て、エラーがこのコードからトリガーされます。
if (handle instanceof net.Socket) {
message.type = 'net.Socket';
} else if (handle instanceof net.Server) {
message.type = 'net.Server';
} else if (handle instanceof process.binding('tcp_wrap').TCP ||
handle instanceof process.binding('pipe_wrap').Pipe) {
message.type = 'net.Native';
} else if (handle instanceof dgram.Socket) {
message.type = 'dgram.Socket';
} else if (handle instanceof process.binding('udp_wrap').UDP) {
message.type = 'dgram.Native';
} else {
throw new TypeError("This handle type can't be sent");
}
は、かなりの時間を費やして...助けてください!
'process.send()'にコールバック関数を使用していますか?私はかなり間違いがそれによって引き起こされると確信しています。 – robertklep
@robertklepはい、私はsendを処理するコールバック関数を使用しています。しかし私は別のサーバーでそうしていました。あなたのコメントを読んだ後、私はNodejsのバージョンをチェックしました。それが動作しているものはv4.4.3で、動作していないものはv10.10なのです!私はv4.4.3にアップグレードし、正常に動作します。あなたが答えとしてあなたのコメントを投稿した場合は、古いバージョンではprocess.sendへのコールバックがなかったので、コールバックをハンドルとして解釈していると思われますので、私はそれを受け入れることを嬉しく思っています。 – Sam