Repository navigation
fix: an uncaught error in a plugin no longer stops the api or the worker - #49
Merged
Merged
Conversation
Plugin methods run in an async context that names the plugin. The process-level handler logs an uncaught exception or unhandled rejection raised in that context (plugin-uncaught-error) and keeps the process running; any other one is logged (uncaught-error) and still exits.
…lugin calls The uncaught error handler now rejects the pending plugin call with the error it raised, so an api request answers and a worker task releases its slot instead of waiting forever. Plugin calls made by the api (prepare, list) also fail with a 504 after 60 s.
- an uncaught error raised after its plugin call settled (a connection reused across calls) fails the pending calls of the same plugin, so a worker task cannot hang forever - task log callbacks run outside of the plugin context: an error on a host resource they open still stops the process - more than 20 uncaught plugin errors in 10 minutes stop the process - a plugin call timeout is logged as a warning, the api timeout is 45 s - prepare lets a 5xx error through instead of turning it into a 400
…0 s api timeout The ingresses in front of catalogs time out after 600 s, a 60 s plugin call timeout answers well before them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plugin methods now run in an async context (
AsyncLocalStorage, the mechanism behindwithLogContext) that names the plugin call, in the api (getPlugin) and in the worker. A process-level handler classifies uncaught exceptions and unhandled rejections:plugin-uncaught-error(plugin,pluginMethod), the pending call rejects with that error and the process keeps running;uncaught-error,plugin-uncaught-errors-limit), then exit 1.Task log callbacks given to plugins run outside of the plugin context, so an error on a host resource they open (mongo, ws) still stops the process. Plugin calls made by the api (
prepare,list) fail with a 504 after 60 s (plugin-call-timeoutwarning);preparelets a 5xx through instead of turning it into a 400.Why: an
ECONNRESETemitted by the ssh2 client ofcatalog-sftpafter the connection, with no'error'listener, crashed the catalogs api on every attempt in a user's scenario. The plugin is fixed incatalog-sftp0.5.2. This makes sure another plugin bug of the same kind fails its own call instead of taking down the service.Heads-up:
tmpDirfiles) is not cleaned up until the next restart; the error limit bounds that.