Merge pull request #93 from overleaf/spd-econnreset

Handle ECONNRESET in the same way as EPIPE
This commit is contained in:
Simon Detheridge 2020-02-04 14:04:58 +00:00 committed by GitHub
commit 85db0822eb

View file

@ -141,7 +141,8 @@ if Settings.shutdownDrainTimeWindow?
if Settings.errors?.catchUncaughtErrors if Settings.errors?.catchUncaughtErrors
process.removeAllListeners('uncaughtException') process.removeAllListeners('uncaughtException')
process.on 'uncaughtException', (error) -> process.on 'uncaughtException', (error) ->
if error.code == 'EPIPE' if ['EPIPE', 'ECONNRESET'].includes(error.code)
Metrics.inc('disconnected_write', 1, {status: error.code})
return logger.warn err: error, 'attempted to write to disconnected client' return logger.warn err: error, 'attempted to write to disconnected client'
logger.error err: error, 'uncaught exception' logger.error err: error, 'uncaught exception'
if Settings.errors?.shutdownOnUncaughtError if Settings.errors?.shutdownOnUncaughtError