realglobe-Inc / v-cloud

Cloud site for v
MIT License
1 stars 0 forks source link

ECONNRESETでプロセスが落ちる #3

Closed tanaka0x closed 6 years ago

tanaka0x commented 6 years ago

クライアント側がwebsocketの終了手順を正しく行わない場合にRSTパケットが送られ、アプリケーションが終了してしまう

% PATH=$PATH:$(pwd)/node_modules/.bin $(yarn bin)/pon debug
[env:debug] Task started...

[env:debug] =========================================
[env:debug]  DEBUG: "undefined" -> "app:*"
[env:debug]  NODE_ENV: "undefined" -> "development"
[env:debug] =========================================

[env:debug] ...done! (4ms)

[debug:server] Task started...
=============================

V Cloud listening on port 7001

=============================
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at _errnoException (util.js:1024:11)
    at TCP.onread (net.js:615:25)
[debug:server] ...done! (12691ms)
tanaka0x commented 6 years ago

v-spot-wsにエラーハンドラを追加すれば落ちなくなるみたいです

// VSpotWSServer.js
// ...

wsProxy(ws, {
  // ...
})

ws.on('error', async function onError (e) {
  debug('error', e)
  connector.disconnect()
})

ws.on('close', async function onClose () {
  // ...
})

// ...
okunishinishi commented 6 years ago

PR大歓迎