Skip to content

Keep the local data file when the update on start-up fails, and register it all the same - #196

Draft
jwrosewell wants to merge 2 commits into
release/4.5.12from
fix/update-on-startup-keeps-local-file
Draft

jwrosewell wants to merge 2 commits into
release/4.5.12from
fix/update-on-startup-keeps-local-file

Conversation

@jwrosewell

@jwrosewell jwrosewell commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Closes #165.

Problem

register returned the start-up update's error with ? (pipeline-engines/src/data_update_service.rs line 171) before it installed the watcher, scheduled the polls or kept the registration, and both engine builders turned that error into a failed build (device-detection-onpremise/src/builder.rs lines 247 to 249, ip-intelligence-onpremise/src/builder.rs lines 258 to 260). An engine with update on start-up on could not be built while the update server was unreachable or refusing it, although the builder had already loaded the local data file, and a file registered directly was never polled or watched after a failed start-up update.

The specification's update on start-up process falls back to the local file when the update fails, and fails only when there is none (data-updates.md lines 266 to 271). Java does this (DataUpdateServiceDefault.java lines 406 to 412). .NET throws instead, which the specification does not ask for. #165 has the details.

Change

  • register logs a failed start-up update as a warning, registers the data file all the same, and then returns the failure, so a caller still learns of it and the updates that follow still run.
  • Both engine builders return the engine when the start-up update fails, as it has loaded the local file.

How it was verified

New tests:

  • a_failed_update_on_start_up_still_registers_the_data_file (pipeline-engines/tests/update_on_startup.rs) registers a file whose update URL nothing listens on, and checks the error is returned and the file is registered.
  • an_engine_builds_from_its_data_file_when_the_update_on_start_up_fails, in device-detection-onpremise/tests/update_on_startup.rs with the Lite Hash file and in ip-intelligence-onpremise/tests/update_on_startup.rs with the ASN file, builds an engine with update on start-up on and an unreachable update URL, and checks it builds, its file is registered, and it detects or looks up with the local file.

Before the change, on a branch holding only the new tests, all three fail. register returns the error with the file unregistered (left: 0, right: 1 for the count of registered files), and both engine builders fail, for example PipelineConfiguration { message: "data update failed (HttpsError): error accessing data update service at 'http://127.0.0.1:54537/download': ..." }. After it, all three pass.

Locally on Windows, with all seven fixes of this sweep merged together (#175, #178, #182, #184, #194, #195 and #196), cargo test --no-fail-fast -p fiftyone-pipeline-engines -p fiftyone-device-detection-onpremise -p fiftyone-ip-intelligence-onpremise -p fiftyone-device-detection -p fiftyone-ip-intelligence -- --nocapture, with 51DEGREES_DD_PATH naming the Lite Hash file, Enterprise-HashV41.hash beside it, and 51DEGREES_IPI_PATH naming the ASN file, 51Degrees-LiteV41.ipi beside it, gives 130 passed, 0 failed and 2 ignored across 24 test binaries. With the fixes merged, cargo doc --workspace --no-deps with RUSTDOCFLAGS="-D warnings" passes, and rustfmt --check passes on every file the seven fixes change. cargo clippy --workspace --all-targets -- -D warnings on the merged fixes has not run yet. The Pull Request workflow, which builds and tests each pull request on every platform, is waiting for approval to run.

Behaviour that changes

An engine with update on start-up on now builds from its local data file when the start-up update fails, and the service logs the failure as a warning. A caller of register still gets the error, now with the file registered.

What remains

…ter it all the same

The specification says a failed update on start-up falls back to the local
file, and fails only when there is none. The service returned before it
registered the data file, so the file was never polled or watched, and
both engine builders turned the error into a failed build, so an
application could not start while the update server was unreachable or
refusing requests. The service now logs the failure and registers the file
all the same, and the builders return the engine, which has already loaded
the local file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant