From 8e45a62e32260f095c4622d462ca896e7b6c9771 Mon Sep 17 00:00:00 2001 From: Simon Detheridge Date: Tue, 4 Feb 2020 13:58:45 +0000 Subject: [PATCH 1/2] Handle ECONNRESET in the same way as EPIPE --- services/real-time/app.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/real-time/app.coffee b/services/real-time/app.coffee index 1aeaec4718..b27e2dd0f9 100644 --- a/services/real-time/app.coffee +++ b/services/real-time/app.coffee @@ -141,7 +141,8 @@ if Settings.shutdownDrainTimeWindow? if Settings.errors?.catchUncaughtErrors process.removeAllListeners('uncaughtException') process.on 'uncaughtException', (error) -> - if error.code == 'EPIPE' + if ['EPIPE', 'ECONNRESET'].includes(error.code) + Metrics.inc('disconnected_write') return logger.warn err: error, 'attempted to write to disconnected client' logger.error err: error, 'uncaught exception' if Settings.errors?.shutdownOnUncaughtError From 4102aa0580808ac08b6d63c6571a922c20604b11 Mon Sep 17 00:00:00 2001 From: Simon Detheridge Date: Tue, 4 Feb 2020 14:03:56 +0000 Subject: [PATCH 2/2] Add more detail to metric --- services/real-time/app.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/real-time/app.coffee b/services/real-time/app.coffee index b27e2dd0f9..677737f862 100644 --- a/services/real-time/app.coffee +++ b/services/real-time/app.coffee @@ -142,7 +142,7 @@ if Settings.shutdownDrainTimeWindow? process.removeAllListeners('uncaughtException') process.on 'uncaughtException', (error) -> if ['EPIPE', 'ECONNRESET'].includes(error.code) - Metrics.inc('disconnected_write') + Metrics.inc('disconnected_write', 1, {status: error.code}) return logger.warn err: error, 'attempted to write to disconnected client' logger.error err: error, 'uncaught exception' if Settings.errors?.shutdownOnUncaughtError