Repository navigation
Report a data update download cut short as an error accessing the service, whatever urllib3 is installed - #131
Merged
Merged
Conversation
…cessing the service
…tent-Length itself
…vice, whatever urllib3 is installed specifications#145 puts a response that ended before the whole file arrived in the row of the errors table for an error accessing the data update service. urllib3 2 raises for a body shorter than its Content-Length, which the service already reports that way, but urllib3 1, which requests still allows, gives the bytes that arrived with no error, and the service then used the cut short file. The service now compares the bytes received with the Content-Length itself, unless the response has a Content-Encoding, in which case the length counts the encoded bytes.
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.
A data update download whose response ends before the whole file has arrived is now reported as an error accessing the data update service, whichever version of urllib3 is installed, and the data in use is kept.
The problem
The Data Update Service downloads with
requests.getand reads the whole body inside that call (datafile_update_service.pylines 152 to 161 at 3f936f8d). With urllib3 2, whichrequestsinstalls today, a body shorter than itsContent-LengthraisesChunkedEncodingError, aRequestException, which the service already reports as "Error accessing data update service".requests2.34 still accepts urllib3 1.26, and that version gives the bytes that arrived with no error, so the service took the cut short file as a successful update and refreshed the engine with it. A chunked response cut short raises with either version.What the specification says
data-updates.md, Errors, line 500 (specifications#145), puts "Connecting to the data update URL failed, or its response ended before the whole file arrived" in the row with the log level Error, the status
AUTO_UPDATE_HTTPS_ERRand the message "Error accessing data update service at '' for engine ''".What changed
After the status checks, the service compares the bytes received with the
Content-Lengththe response gave and, when fewer arrived, logs the row's message with "The response ended after of the bytes it gave as its Content-Length." as the detail, reportsAUTO_UPDATE_HTTPS_ERRand keeps the data in use (datafile_update_service.py,_cut_short). A response with aContent-Encodingis not measured, as its length counts the encoded bytes andrequestsgives the decoded ones.Four tests in
test_datafile_update_http.py,ShortDownloadTests. Two run a local HTTP server that promises 1,000 bytes and sends 100, once withContent-Lengthand once in chunks with no last chunk. One gives the service a reply holding 100 bytes with aContent-Lengthof 1,000, which fails onrcwhatever urllib3 is installed. One checks that a reply with aContent-Encodingis not measured.How it was verified
rcat 3f936f8 with only the two server tests (0a75521) and a temporary workflow that installsurllib3<2. On Ubuntu and on Windows the service took the response shorter than itsContent-Lengthas a successful update ("True is not false"), and the chunked one passed.requests2.34.2 installs. Both server tests passed on both systems, so with urllib3 2 the service already reported both.testTheLengthIsCheckedWhicheverHttpLibraryIsInstalledfailed on both systems ("True is not false", "1 failed, 45 passed").fiftyone_pipeline_engines, on both systems in both runs.Setting 'PullRequestSha'lines all name 06fbc1c, and Configure printed "Left out 5 macOS entries". An earlier build of the same head, 43563210178, hung in Configure's asset download and was cancelled before any test ran. 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.What it releases
fiftyone_pipeline_engineschanges, so it is released with the packages that depend on it. Monday's release already holds it and its dependants, as the plan of Publish dry run 43528475739 shows, so this adds no package.Merge order
#87 changes other parts of the same file and merges in either order.