服务网格部署时,将目标IP为127.0.0.1的请求给代理了,对于master 与worker 之间的通信使用localhost通信,流量经过了envoy。 而库会报如下错误:
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-06-24 10:52:08,856 ERROR 118 nodejs.SyntaxError: Unexpected token c in JSON at position 2 (address: 127.0.0.1:29489)
at JSON.parse ()
at Function.decode (/home/app/node_modules/cluster-client/lib/protocol/packet.js:86:26)
at Follower.decode (/home/app/node_modules/cluster-client/lib/follower.js:68:27)
at Follower._readPacket (/home/app/node_modules/tcp-base/lib/base.js:308:25)
at Follower._handleReadable (/home/app/node_modules/tcp-base/lib/base.js:374:26)
at Socket.socket.on (/home/app/nodemodules/tcp-base/lib/base.js:392:40)
at Socket.emit (events.js:189:13)
at emitReadable (_stream_readable.js:535:12)
at onEofChunk (_stream_readable.js:513:7)
at readableAddChunk (_stream_readable.js:233:5)
at Socket.Readable.push (_stream_readable.js:220:10)
at TCP.onStreamRead (internal/stream_base_commons.js:125:12)
pid: 118
2020-06-24 10:52:08,857 WARN 118 [ClusterClient:Watcher] follower closed, and try to init it again
2020-06-24 10:52:08,860 ERROR 118 [app_worker] receive disconnect event in cluster fork mode, exitedAfterDisconnect:false
2020-06-24 10:52:08,860 INFO 118 [app_worker] exit with code:0
2020-06-24 10:52:08,947 ERROR 323 nodejs.SyntaxError: Unexpected token c in JSON at position 2 (address: 127.0.0.1:29489)
at JSON.parse ()
at Function.decode (/home/app/node_modules/cluster-client/lib/protocol/packet.js:86:26)
at Follower.decode (/home/app/node_modules/cluster-client/lib/follower.js:68:27)
at Follower._readPacket (/home/app/node_modules/tcp-base/lib/base.js:308:25)
at Follower._handleReadable (/home/app/node_modules/tcp-base/lib/base.js:374:26)
at Socket.socket.on (/home/app/nodemodules/tcp-base/lib/base.js:392:40)
at Socket.emit (events.js:189:13)
at emitReadable (_stream_readable.js:535:12)
at onEofChunk (_stream_readable.js:513:7)
at readableAddChunk (_stream_readable.js:233:5)
at Socket.Readable.push (_stream_readable.js:220:10)
at TCP.onStreamRead (internal/stream_base_commons.js:125:12)
pid: 323
最小可复现仓库
请使用 npm init egg --type=simple bug
创建,并上传到你的 GitHub 仓库
复现步骤,错误日志以及相关配置
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-06-24 10:52:08,856 ERROR 118 nodejs.SyntaxError: Unexpected token c in JSON at position 2 (address: 127.0.0.1:29489)
at JSON.parse ()
at Function.decode (/home/app/node_modules/cluster-client/lib/protocol/packet.js:86:26)
at Follower.decode (/home/app/node_modules/cluster-client/lib/follower.js:68:27)
at Follower._readPacket (/home/app/node_modules/tcp-base/lib/base.js:308:25)
at Follower._handleReadable (/home/app/node_modules/tcp-base/lib/base.js:374:26)
at Socket.socket.on (/home/app/nodemodules/tcp-base/lib/base.js:392:40)
at Socket.emit (events.js:189:13)
at emitReadable (_stream_readable.js:535:12)
at onEofChunk (_stream_readable.js:513:7)
at readableAddChunk (_stream_readable.js:233:5)
at Socket.Readable.push (_stream_readable.js:220:10)
at TCP.onStreamRead (internal/stream_base_commons.js:125:12)
pid: 118
2020-06-24 10:52:08,857 WARN 118 [ClusterClient:Watcher] follower closed, and try to init it again
2020-06-24 10:52:08,860 ERROR 118 [app_worker] receive disconnect event in cluster fork mode, exitedAfterDisconnect:false
2020-06-24 10:52:08,860 INFO 118 [app_worker] exit with code:0
2020-06-24 10:52:08,947 ERROR 323 nodejs.SyntaxError: Unexpected token c in JSON at position 2 (address: 127.0.0.1:29489)
at JSON.parse ()
at Function.decode (/home/app/node_modules/cluster-client/lib/protocol/packet.js:86:26)
at Follower.decode (/home/app/node_modules/cluster-client/lib/follower.js:68:27)
at Follower._readPacket (/home/app/node_modules/tcp-base/lib/base.js:308:25)
at Follower._handleReadable (/home/app/node_modules/tcp-base/lib/base.js:374:26)
at Socket.socket.on (/home/app/nodemodules/tcp-base/lib/base.js:392:40)
at Socket.emit (events.js:189:13)
at emitReadable (_stream_readable.js:535:12)
at onEofChunk (_stream_readable.js:513:7)
at readableAddChunk (_stream_readable.js:233:5)
at Socket.Readable.push (_stream_readable.js:220:10)
at TCP.onStreamRead (internal/stream_base_commons.js:125:12)
pid: 323
相关环境信息
- 操作系统:linux 内核 4.18.0
- Node 版本:v10.15.3
- Egg 版本:2.26.0