Repository navigation
Log an error thrown by a data update listener rather than end the process - #65
Merged
Merged
Conversation
…rther The update status is reported from timer, request and file system watcher callbacks, where an error thrown by an application's updateComplete listener would be uncaught and end the process. The error must be logged, and the other listeners must still be called.
…cess complete called the updateComplete listeners through emit with no catch, so a listener that threw inside a timer, HTTP or fs.watch callback was an uncaught exception that ended the Node process. Each listener is now called in turn and an error it throws is logged, as an error thrown by onUpdateComplete already was. The raw listeners are called, so a once listener is still removed after it runs.
The comment on callbackErrorText said every language uses this wording. Python does, and .NET has no message naming the callback, so the comment now says Python.
…ole where there is no pipeline
…or to the console where there is no pipeline
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.
The data update service reports how each update ended through the
updateCompleteevent. Onrc,completecalled the listeners withemitand no catch. The status is reported from timer, HTTP andfs.watchcallbacks, so a listener that throws there is an uncaught exception, which ends the Node process.The cross-language audit found this. The Data update page, at the fixed commit
67ead698, says in its Errors section thatand, in the next line,
The Errors section at e89679e9, the specifications
rchead, now has a row for this error, "An onUpdateCallbacks callback raised an error", at Error with the message "An unhandled error occurred while checking for automatic updates for engine '<Engine type name>'", and saysand
What changed
completecalls eachupdateCompletelistener in turn and logs, at error level, an error one throws, so the other listeners are still called. It calls the raw listeners, so aoncelistener is removed after it runs, asemitwould remove it.Both update complete callbacks, the
updateCompletelisteners and the data file's ownonUpdateComplete, now log the same text, which isbuilt by a named
callbackErrorTexthelper from the existingengineNameanderrorDetailhelpers. That is .NET's message for this error,MessageAutoUpdateUnhandledError, which .NET logs with the exception attached (DataUpdateService.cslines 673 to 683 at b3e90b4). Node's log takes a string, so the cause follows the text as "Error detail". The data file's own callback was already caught, but it logged the bare error, so it is brought to the same text here.logused to write nothing when the service had no pipeline attached, which is its state from the constructor until a pipeline takes it, so a callback error in that time was lost. It now writes an error to the console, with any licence key masked, as a pipeline with no error listener does.Tests
pipeline/fiftyone.pipeline.engines/tests/dataUpdateSpecification.test.jsholds two tests.oncelistener, then makes a memory update. The update returns, theoncelistener hears the status once, and the error is logged once with the text above.onUpdateCompletethat throws and checks the same text, which covers the second exit path ofcomplete.The listener catch, first round, on
41e3b66:rccode (1 of 62 fails, "The listener failed." thrown out ofupdateFromMemory): https://github.com/51Degrees/51degrees-node/actions/runs/4289602255541e3b66(62 passed): https://github.com/51Degrees/51degrees-node/actions/runs/4289606444141e3b66, success: https://github.com/51Degrees/51degrees-node/actions/runs/42897791416The callback message, second round:
Red, on the tests-only commit
9993836, which expects the message above against the previous bare error. 2 of 35 fail indataUpdateSpecification.test.js, being the two tests above: https://github.com/51Degrees/51degrees-node/actions/runs/42980185833d396860corrects the helper's comment, which had said every language uses this wording. Python does, and .NET has no message naming the callback.rcis merged in atb596a1d, which brings the currentcxxsubmodule.Full build on
b596a1d, success. Configure and the Ubuntu, Ubuntu ARM and Windows jobs on Node 22 and 24 pass, Configure printed "Left out 2 macOS entries", and all 7Setting 'PullRequestSha'lines areb596a1d489c3c8d3a09b1784692118f04ee3f02c: https://github.com/51Degrees/51degrees-node/actions/runs/42981181357The .NET wording and the console, third round:
Red, run 42995720871 on branch
tmp/node-65-red2, the tests-only commit16035e3overb596a1d's code. 3 of 36 fail indataUpdateSpecification.test.js, being the two tests above, which now expect .NET's text, and "a callback error with no pipeline is written to the console".Green and full build on the head
24993da, success, run 42991393989. Configure and the Ubuntu, Ubuntu ARM and Windows jobs on Node 22 and 24 pass, Configure printed "Left out 2 macOS entries", and all 7Setting 'PullRequestSha'lines are24993da016ab49eb0bd22939cadcdc504f217761.macOS was left out of this draft's full build under the 9 November decision. The rc head is built with macOS before it merges into main.
Not done here
51degrees-python#69, 51degrees-python#98 and node#69 carried the earlier callback wording and move to the same .NET text in their own drafts.