Repository navigation
Give every check an overall time limit and run one check at a time per page - #26
Merged
Merged
Conversation
…r page A check of the API now ends within CHECK_DEADLINE seconds (default 35). The limits of single requests stay (name lookup, connection and answer per redirect, links, SOyA web-cli, didlint), but each request waits at most the time left. Once the time is up, no further request is sent: the criteria evaluated so far keep their results, the others are skipped as not_evaluated with the reason, and timeLimit and notices in the result say that the limit was reached. Link requests are all joined before the check ends, so nothing of a check keeps running after its answer. The start page waits CHECK_DEADLINE plus 5 s (40 s by default) and runs one check at a time: while a check runs, the form, the examples and "Try again" send no further request. Tests cover a hanging passport host, slow redirects, many slow links, a slow SOyA web-cli and didlint, a partial result at the time limit, a JWS request cut off by it and two starts from the same page.
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.
Summary
A check could take far longer than the start page waits for it: against a passport host that accepts connections but never answers, a check ran for about 100 s, and it kept running on the server after the page had given up. While three such checks ran, the service answered nothing else.
CHECK_DEADLINEseconds, 35 by default. The limits of single requests stay (name lookup 5 s, connection 10 s, answer 20 s per redirect, links 10 s, SOyA web-cli 5 s and 30 s, didlint 10 s per request and 20 s per check), but each request waits at most the time left, connection and answer together.skippedwithreason_codenot_evaluatedand the reason "the time limit of 35 s for this check was reached". A timeout counts against the host only if its own limits were not shortened by the time limit. The result has a new fieldtimeLimit(seconds,reached) and a notice when the limit was reached.CHECK_DEADLINEplus 5 s (40 s by default). While a check runs, the form, the example links and "Try again" send no further request.Changes
app/services/check_deadline.rb(new): the time limit of one check; splits the time left into connect and read limits per request.app/services/http_resolver.rb,passport_fetcher.rb,links_check.rb,soya_web_cli.rb,didlint.rb: limits cut to the time left; name lookup with an overall limit; link requests joined.app/services/passport_linter.rb,app/controllers/api/v1/validations_controller.rb: one time limit per request, partial result,timeLimit, notice.app/javascript/check_client.js,app/views/home/show.html.erb: one check at a time per page.config/initializers/dpplint.rb:CHECK_DEADLINE;CHECK_TIMEOUTfollows it.swagger/v1/swagger.yaml,README.md:timeLimit, the limits.test/services/check_deadline_test.rb,test/integration/check_time_limit_test.rb,test/support_slow_server.rb(new), JavaScript tests for one check at a time, adapted page and resolver tests.Tests
not_evaluatedwith the reason, a criterion without network access staysnot_applicable;timeLimit.reachedis true.