Various error log improvements #100
No reviewers
Labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
cadence/out-of-your-element!100
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "l1s5/out-of-your-element:log-improvements"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi!
This PR consists mostly of new
console.errorstatements, with one commit moving some error logs out of a guard and another combining separate invocations to make it easier to read in a log ingester (loki in our case).These have helped us discover various things to fix (some coming in future PRs), and will hopefully lead to future bug reports from others being easier to analyze as well.
Note that some of these have a side effect of not crashing ooye where the previous implementation would have. I'm guessing a lot of people are running the bridge on auto-restart anyway, so it might not be a big deal (and it haven't been for us so far), but you probably know better than me whether it could put the bridge in a weird state.
m2derror reports 8e9458d41cd2mretrigger timeouts d5972187ebCONNECTION_DEBUG2a34e797c3See comments on diffs.
If any of this logging helped you fix an actual error, then I'd like to see the fix, to demonstrate that logging that part is useful in the real world.
@ -40,2 +40,3 @@debugRetrigger(`[retrigger] SET TIMER id = ${id}`)this.timers.set(id, setTimeout(() => this.resolve(id, false), 60 * 1000).unref()) // 1 minutethis.timers.set(id, setTimeout(() => {console.warn(`[retrigger] gave up waiting for ${id} to finish bridging after 1 minute, skipping ${this.resolves.get(id)?.length ?? 0} pending changes`)I don't want to print retrigger mismatches since these are expected in normal operation. Logging this is noisy and wouldn't help to solve actual problems in retrigger. The complete logging from DEBUG_RETRIGGER is necessary for that.
@ -62,0 +69,4 @@})}addEventLogger("error", "Error")addEventLogger("disconnected", "Disconnected")I don't want to move these outside of the CONNECTION_DEBUG filter because printing "disconnected" and not printing anything after it comes back online makes the situation look bad when there was actually no issue.
If there are actually any connection reliability issues in Cloudstorm (which I think we've dealt with, because I haven't seen any in many months) then more logging is needed to diagnose those anyway.
@ -115,1 +116,3 @@console.error("Failed to sync missed events. To retry, please fix this error and restart OOYE:")console.error("Failed to sync missed events. To retry, please fix this error and restart OOYE:", e)} else {console.error(e)Errors in this branch are caused by internet outage. Logging it is noise because it can error from just checking if anything needed to be done, even if nothing actually took place. That's why I moved this into an if branch.
@ -16,6 +17,10 @@ const {reg} = require("./src/matrix/read-registration")const passthrough = require("./src/passthrough")const db = new sqlite("ooye.db")process.on("unhandledRejection", e => {I don't want to apply the
unhandledRejectionchange because the process dying has helped me notice a few bugs that I wouldn't have noticed otherwise. If there's an error, I want to fix it at the source, not suppress it and pretend everything's okay. Auto-restart is a great choice for everyone else.This is incomplete at the goal of preventing crashes anyway because you need to deal with
errorevents too.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.