Repository navigation
Fix: Full review 4.0.12 fixes part 1 - #256
Merged
Merged
Conversation
…rejections in the XMDS error parser
rubenberttpingol
requested review from
dasgarner and
nadzpogi
and removed request for
dasgarner
October 5, 2026 06:29
nadzpogi
approved these changes
Oct 6, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #255
Fixes the ten P0 defects from the 4.0.12 full review, plus two defects found while testing them. Each one could lose proof of play, freeze or hang the player, break media on screen, or waste downloads.
Bugs fixed
Proof of play
submitStats()returned an error object on failure, which counts as true, so the caller deleted the batch.trueonly when the CMS confirms, and both callers (index.ts,transferCms.ts) check=== true.PoPStatsranDELETE FROM statsin its constructor, so a reboot, crash or update lost everything not yet sent.StatsDB.deleteOpen()). Finished, unsent stats are kept and sent on the next collection.Schedule loop
index. A schedule with only interrupts threw a TypeError.indexis incremented. With no normal layouts, the interrupts play on their own.Invalid array length. That took up to 2 GB of memory and several seconds. SSP without an average ad duration did the same.loopDuration()(shareOfVoice.ts) counts a missing, zero or NaN duration as 60 s, but only when the hour is divided up; playback length is unchanged. SSP is only added when an ad duration is known.isAssessingLayouts/isAssessingOverlaysstayedtrue, so every later assessment was skipped. A layout with an emptygeoLocationwas enough to trigger it.try/finally, and a geofence that can't be read leaves that layout out.Main process
run()starts the player once. A later call only triggers a collection, so a changed CMS is still picked up straight away.Downloads
.partfile and are renamed into place only once complete and verified. A failed update leaves the old file and its database row as they were, so it keeps playing until the update succeeds.arraybuffer+writeFileSync). Memory grew by the size of the file being downloaded, and the write blocked the main process.collect()does not wait for the downloads it starts, so a collection could arrive while a download pass was still running, fetch the list again and start a second pass. On a first boot against a real CMS, 3 videos downloaded twice at once and 4 downloads ran against a limit of 2.downloadFile()also waits for a download already running for the same file instead of starting another.XMDS errors
Error.parse()runs in a callback nothing awaits, and read the SOAP fault without checking each step. An empty body (a typical proxy 500 or 502), a well-formed non-SOAP page, or an envelope without a Fault all threw.Testing
Every bug was reproduced against the unchanged code before it was fixed, using a harness kept outside the repo. The harness runs the real main-process modules, including all of
src/main/index.ts, with Electron stubbed out.Synthetic checks: all ten reproduce on
develop, and none reproduce on this branch. Normal cases for downloads and the schedule loop still pass.Against a real CMS (
develop.xibo.co.uk, a test display with 5 normal layouts, a 1500 s share-of-voice interrupt, a 1 minute screenshot interval and stats on). Failures were injected one at a time through a proxy that otherwise passed every reply through unchanged.true)true)All 86 files the CMS listed (media, layouts, fonts,
bundle.min.js,fonts.css, HTML package) pass the new MD5 check.The real CMS content is too small (largest file 6.8 MB) to show #10. On a 600 MB synthetic download, memory growth fell from 620 MB to 41 MB.
Notes
run()throws partway through, a renderer reload no longer retries the startup. Before, a reload re-ran it but duplicated every handler that had already registered..partfile can be left behind if the player stops mid-download. It is not served or used, and is replaced on the next attempt.handleError()'s "not authorised" check compares the message before the async parse has filled it in, so it never fires. It has no effect today: the one caller that relies on it gets its error fromhandleXmdsError, which is awaited.