aisstream / issues

7 stars 3 forks source link

Error: Client network socket disconnected before secure TLS connection was established #12

Closed mathieu-dumoutier closed 1 year ago

mathieu-dumoutier commented 1 year ago

Since the end of the last week I have this error when I try to connect to the websocket :

node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: Client network socket disconnected before secure TLS connection was established
    at connResetException (node:internal/errors:718:14)
    at TLSSocket.onConnectEnd (node:_tls_wrap:1600:19)
    at TLSSocket.emit (node:events:525:35)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on WebSocket instance at:
    at emitErrorAndClose (/var/www/side-projects/prod/ship-tracker/node_modules/ws/lib/websocket.js:1004:13)
    at ClientRequest.<anonymous> (/var/www/side-projects/prod/ship-tracker/node_modules/ws/lib/websocket.js:856:5)
    at ClientRequest.emit (node:events:513:28)
    at TLSSocket.socketErrorListener (node:_http_client:496:9)
    at TLSSocket.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: 'ECONNRESET',
  path: undefined,
  host: 'stream.aisstream.io',
  port: 443,
  localAddress: undefined
}

Thank you for your help Mathieu

mathieu-dumoutier commented 1 year ago

Seems to be solved :)

mathieu-dumoutier commented 1 year ago

it’s seems to be again…

aisstream commented 1 year ago

We do aggressively drop connections at the load balancer level if they exceed more than one connection attempt a second. It is possible this is whats going on here.

We have an open issue to return an error to the client when this happens so they knows whats going on instead of just dropping the connection.

aisstream commented 1 year ago

We have restarted the entire websocket service too see if this helps at all.

aisstream commented 1 year ago

We have modified our rate limiting to now return a 429 HTTP Error when a client is being rate limited. This will cause the websocket handshake to fail but should provide more meaningful error message to the client vrs our current rate limiting which just drops the tcp connection.