Repository navigation
Count only service trouble towards a recovery period - #198
Draft
jwrosewell wants to merge 1 commit into
Draft
jwrosewell wants to merge 1 commit into
jwrosewell wants to merge 1 commit into
Conversation
The cloud request engine's recovery gate is shared by every visitor, and every failed answer counted towards it. The cloud service answers a request whose user agent is 32,000 bytes or more with a 404 and a plain text body, and the JSON endpoint accepts a form body of up to 64 KB, so one visitor sending ten such requests within 100 seconds opened a 60 second recovery period in which no visitor's request reached the cloud. A failed answer now counts only when it says the service is in trouble, being a status of 500 or more, a 429, or a success status whose body could not be used. A request that did not complete counts as before. A status from 400 to 499 other than 429 answers the request's own content and leaves the gate as it was.
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.
Closes #197.
Problem
The cloud request engine counted every failed answer towards its recovery gate (
cloud-request-engine/src/engine.rslines 1223-1259). The gate belongs to the engine, so every visitor shares it, and with the default settings ten failures within 100 seconds stop every request reaching the cloud for 60 seconds.Measured against
cloud.51degrees.comon 26 October 2026, the data endpoint answers auser-agentof 16,000 bytes with200, and one of 32,000 or 60,000 bytes with404and a plain text body. The web integration's JSON endpoint accepts a form body of up to 64 KB and passes its fields to the engine as evidence, so one visitor sending ten such requests opened a recovery period for everyone, and could keep it open.Change
A failed answer counts towards the gate only when it says the service is in trouble, being a status of 500 or more, a 429, or a success status whose body could not be used. A request that did not complete, such as a timeout, counts as before. A status from 400 to 499 other than 429 answers the request's own content and leaves the gate as it was. The documentation of
CloudRequestEngineand of the crate says which failures count.The recovery mode section of the specification gives the gate's purpose as protecting a site when the cloud becomes slow or fails, and does not say which failures count. The 51Degrees .NET pipeline counts every failure, so this is a difference from it, made because a gate shared by every visitor must not be opened by what one visitor sends.
How it was verified
New tests in
cloud-request-engine/tests/mock_client.rs, over a transport that answers as the service did above, with the default recovery settings:answers_to_one_visitors_own_content_leave_the_next_visitor_served. Ten requests with a 32,000 byteuser-agent, then a visitor with an ordinary one. Before the change, the same scenario failed with the next visitor refused,sending requests to the cloud service is temporarily restricted due to recent failures; recovery resumes in 60.0s. It was run as a test onrelease/4.5.12with this sweep's other fixes merged, none of which touch the gate.service_errors_still_open_a_recovery_period. Ten503answers still open a recovery period, as ten transport failures do in the existingrecovery_mode_blocks_after_repeated_data_failures.Commands, run locally on Windows, on the fix branches of this sweep merged together, with the Device Detection Lite and IP Intelligence ASN data files in
51DEGREES_DD_PATHand51DEGREES_IPI_PATH:The results of these runs are added here when they finish.
Behaviour that changes
400to499answer other than429no longer counts towards a recovery period. With a credential the service refuses, every request now reaches the service and fails at once, where after ten failures the engine used to stop sending for 60 seconds.5xxanswers,429answers and unusable success answers open a recovery period as before.What remains