Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow stale metadata requests to be repeated #127

Merged
merged 21 commits into from
Jul 18, 2024

Conversation

Vectornaut
Copy link
Collaborator

This addresses issue #69 by replacing the flag that says metadata has been requested with a timestamp that says when the metadata was last requested. If the last request was long enough ago that it seems unlikely to succeed, we allow a new request to be started.

Mechanism

When a metadata request starts, it records the time and the reference count, so later threads can judge how likely it is to ever succeed.

When a metadata request finishes, it writes what it found to the database in the following situations:

  • No other thread has set out to fetch the same metadata.
  • Another thread has set out to fetch the same metadata, fearing that we would never come back, but we got back before the other thread did.

To do

This partially addresses issue #33. To completely resolve that issue, we need to set up a similar system for repeating factorization requests.

Similarly, to address #104, we need to set up a similar system for repeating value requests.

Aaron Fenyes added 5 commits April 18, 2024 14:21
This bug fix is needed to test the executor handover feature.
The reference count determines how long we wait before allowing a new
request.
Before, if the last request time was set but no reference count was
recorded, `fetch_metadata` would've crashed when it tried to compute the
wait time. Now, we use a short constant wait time in this situation.
Copy link
Collaborator

@gwhitney gwhitney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you see this, let me know roughly your expected time frame for responding. Given the modest number of hours before the kickoff, I may need to address the comments as best I can myself depending on your availability. Of course, all else equal it's preferable for you to respond as you see appropriate.

In the meantime, I will run and test the new code.

flaskr/nscope/views.py Outdated Show resolved Hide resolved
flaskr/nscope/views.py Outdated Show resolved Hide resolved
flaskr/nscope/views.py Outdated Show resolved Hide resolved
flaskr/nscope/views.py Outdated Show resolved Hide resolved
flaskr/nscope/views.py Outdated Show resolved Hide resolved
@Vectornaut
Copy link
Collaborator Author

Vectornaut commented Apr 21, 2024

If you see this, let me know roughly your expected time frame for responding. (@gwhitney)

Just came back to Numberscope for the evening! I'll remove the debug log messages and bump up the timeout; that should take well under an hour. I haven't looked at the "Bad Gateway" issue yet, so I don't know how long that might take to address.

@gwhitney
Copy link
Collaborator

Note I pushed a small doc change for something that just bit me, so please pull before addressing the review comments (presuming that you'll want to add any further commit(s)).

@gwhitney

This comment was marked as resolved.

@gwhitney
Copy link
Collaborator

On the flip side, this is the only bad thing I have so far gotten the dev server to do (e.g., getting factors worked while it was still downloading backrefs, presuming that downloading wasn't disrupted by the server error), so I am hopeful that if we can get this resolved and the above comments, then this will be good to merge. :-)

Aaron Fenyes added 3 commits April 20, 2024 20:57
Metadata requests for sequences with tens or low hundreds of backrefs
should take around half the wait time given by this curve.
@Vectornaut
Copy link
Collaborator Author

Vectornaut commented Apr 21, 2024

More urgently than that bad gateway, here's an internal server error I encountered while testing starting from a fresh database (that had been properly configured for this PR)

I got this too—from a crawling too fast response! The crash happens because the "crawling too fast" page is plain text rather than JSON. But that gives us an easy way to detect this kind of response! I'll write a test for it.

If you check your logs, you should see a log entry for a "request issue" event; you can get its contents as a Python dictionary by entering entry = [pasted log entry] in the REPL. Decoding the base 64 response value should show you the "crawling too fast" response.

@gwhitney
Copy link
Collaborator

Sounds like really good progress. Make sure it's clear when you think this is ready for further review, thanks.

@Vectornaut
Copy link
Collaborator Author

Vectornaut commented Apr 21, 2024

Update: I'm still working on the test simulating the non-JSON "crawling too fast" response that's currently crashing fetch_metadata. The crash should be easy to prevent, but I'd like to submit the fix with a test that will keep it from cropping up in future revisions. I'll try to have this ready for review by 2–3pm Pacific on Sunday.

@Vectornaut
Copy link
Collaborator Author

Vectornaut commented Apr 21, 2024

I've drafted a test (TestUnavailableSearch in test_wrong_response_type.py) that currently detects to a crash in get_oeis_metadata similar the crash that Glen encountered in get_oeis_name_and_values. On Sunday afternoon, I'll try to extend the test to cover get_oeis_names_and_values and then add error handling to prevent both crashes.

@gwhitney, @katestange: I'd appreciate suggestions for how these endpoints should respond when they get a "crawling too fast" response from the OEIS.

@gwhitney
Copy link
Collaborator

I would generally follow the guidelines in https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503 both for the response to the requestor to backscope, and to the operation of backscope with respect to the oeis. In other words, if the database doesn't have the info being requested, and the oeis 503s when backscope tries to get it, backscope should 503 with a clear explanation and the same retry-after it got from the oeis. And whenever it gets a 503, backscope should put a moratorium on new requests to the oeis for the number of seconds indicated. That moratorium should ideally hold across all threads, including any backref downloads in progress. I suspect you need an entry in some admin table like no_oeis_until that get_oeis checks every time it is called. Or something like that.

Validate with mock OEIS tests simulating situations where B-files or
search results are unavailable.
@Vectornaut
Copy link
Collaborator Author

Vectornaut commented Apr 21, 2024

This code that handles "crawling too fast" responses without crashing is ready for review (@gwhitney, @katestange)!

Right now, the mock OEIS tests that validate this feature are pretty repetitive. They're mostly copied-and-pasted boilerplate, with small adjustments to call different endpoints with different simulated OEIS behavior. I'd like to eventually consolidate these tests into descendants of an abstract mock OEIS test, which would handle the boilerplate. I could do that now if it would make this PR easier to review.

I would generally follow the guidelines in https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503 both for the response to the requestor to backscope, and to the operation of backscope with respect to the oeis.

Returning a 503 error when we get a "crawling too fast" sounds like a good idea in the long run. In 1a5cc55, I've done something simpler and more consistent with the way other exceptions are handled: just return the exception with a 200 status code. Should we improve on that behavior now, or in a later pull request?

Respecting the cool-down period we get from the OEIS might be more involved. I think that's better for a later PR—especially because, to stop back-reference downloading, we need to split the metadata download into smaller chunks.

@katestange
Copy link
Member

I can verify that the PR installs and runs on my machine. I tried various endpoints. The metadata worked nicely. A factoring endpoint http://127.0.0.1:5000/api/get_oeis_factors/A006862/50 caused issue #129 but that is also caused on the current main with a fresh DB, so it's not related to this PR.

@katestange
Copy link
Member

Right now tests pass but http://127.0.0.1:5000/api/get_oeis_name_and_values/A000045 on a fresh DB on my system gives

2024-04-21T22:17:18.131610 Exception on /api/get_oeis_name_and_values/A000045 [GET]
Traceback (most recent call last):
  File "/home/katestange/data/projects/numberscope/frontscope-backscope/backscope/.venv/lib/python3.9/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/katestange/data/projects/numberscope/frontscope-backscope/backscope/.venv/lib/python3.9/site-packages/flask/app.py", line 1473, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/katestange/data/projects/numberscope/frontscope-backscope/backscope/.venv/lib/python3.9/site-packages/flask/app.py", line 882, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/katestange/data/projects/numberscope/frontscope-backscope/backscope/.venv/lib/python3.9/site-packages/flask_cors/extension.py", line 176, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/home/katestange/data/projects/numberscope/frontscope-backscope/backscope/.venv/lib/python3.9/site-packages/flask/app.py", line 880, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/katestange/data/projects/numberscope/frontscope-backscope/backscope/.venv/lib/python3.9/site-packages/flask/app.py", line 865, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
  File "/home/katestange/data/projects/numberscope/frontscope-backscope/backscope/flaskr/nscope/views.py", line 380, in get_oeis_name_and_values
    r = response.json()
  File "/home/katestange/data/projects/numberscope/frontscope-backscope/backscope/.venv/lib/python3.9/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 2 column 1 (char 1)
127.0.0.1 - - [21/Apr/2024 22:17:18] "GET /api/get_oeis_name_and_values/A000045 HTTP/1.1" 500 -

@gwhitney gwhitney marked this pull request as draft April 22, 2024 07:07
@gwhitney
Copy link
Collaborator

Thanks for looking, Kate! @Vectornaut, remove the draft status when you've addressed the latest observed crash and it's ready for further review. Much appreciated.

@Vectornaut
Copy link
Collaborator Author

Vectornaut commented Apr 22, 2024

Right now tests pass but http://127.0.0.1:5000/api/get_oeis_name_and_values/A000045 on a fresh DB on my system gives [...]

That's odd! In your log file, you should find an entry logging this exception. Could you check whether there's a corresponding "request issue" entry just before it, and post that entry if so? (If you don't want to hunt for it, you could also just post the whole log file.)

One thing that could cause this crash is the OEIS returning the "crawling too fast" page with a 200 (success) status code, which wouldn't be caught in the log.

@Vectornaut Vectornaut marked this pull request as ready for review May 16, 2024 07:06
@gwhitney
Copy link
Collaborator

Just pulled executor_handover, activated my venv, and ran flask test, and I get:

...
test_endpoint (flaskr.nscope.test.test_lookup_errors.TestNonexistentSequence.test_endpoint) ... 
  Testing response
FAIL
  Waiting for background work
  Background work done
...
======================================================================
FAIL: test_endpoint (flaskr.nscope.test.test_lookup_errors.TestNonexistentSequence.test_endpoint)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/glen/code/backscope/flaskr/nscope/test/abstract_endpoint_test.py", line 118, in test_endpoint
    self.assertEqual(sorted_log_output, self.expected_log_output)
AssertionError: Lists differ: [{'ev[728 chars]4KICBib2R5IHsgbWFyZ2luOiAwOyBwYWRkaW5nOiAwOyB9[4262 chars]r']}] != [{'ev[728 chars]4KICB0dCB7IGZvbnQtZmFtaWx5OiBtb25vc3BhY2U7IGZv[4262 chars]r']}]

First differing element 0:
{'eve[727 chars]4KICBib2R5IHsgbWFyZ2luOiAwOyBwYWRkaW5nOiAwOyB9[4261 chars]or']}
{'eve[727 chars]4KICB0dCB7IGZvbnQtZmFtaWx5OiBtb25vc3BhY2U7IGZv[4261 chars]or']}

  [{'event': 'request issue',
    'log_level': 'error',
-   'response': 'PCBHRVQgL0EwMDAwMDAvYjAwMDAwMC50eHQgSFRUUC8xLjENCjwgSG9zdDogb2Vpcy5vcmcNCjwgVXNlci1BZ2VudDogcHl0aG9uLXJlcX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hIGhyZWY9Ii9kZW1vMS5odG1sIj5EZW1vczwvYT4gfAogICAgICA8',
    'tags': ['http error']}]

----------------------------------------------------------------------
Ran 11 tests in 3.398s

FAILED (failures=1)

@Vectornaut
Copy link
Collaborator Author

This test is failing because a temporary change to the OEIS site—the black banner that reads "The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support..."—is interpreted as an unexpected response. You can see the test pass by changing expected_oeis_response_b64 to include the banner:

expected_oeis_response_b64 = 'PCBHRVQgL0EwMDAwMDAvYjAwMDAwMC50eHQgSFRUUC8xLjENCjwgSG9zdDogb2Vpcy5vcmcNCjwgVXNlci1BZ2VudDogcHl0aG9uLXJlcXVlc3RzLzIuMzEuMA0KPCBBY2NlcHQtRW5jb2Rpbmc6IGd6aXAsIGRlZmxhdGUNCjwgQWNjZXB0OiAqLyoNCjwgQ29ubmVjdGlvbjoga2VlcC1hbGl2ZQ0KPCANCg0KPiBIVFRQLzEuMSA0MDQgTm90IEZvdW5kDQo+IENhY2hlLUNvbnRyb2w6IHByaXZhdGUsIG5vLXN0b3JlDQo+IENvbnRlbnQtVHlwZTogdGV4dC9odG1sOyBjaGFyc2V0PXV0Zi04DQo+IERhdGU6IFR1ZSwgMTQgTWF5IDIwMjQgMjM6NDI6NTIgR01UDQo+IFZhcnk6ICoNCj4gVHJhbnNmZXItRW5jb2Rpbmc6IGNodW5rZWQNCj4gDQoKPCFET0NUWVBFIGh0bWwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDMuMiBGaW5hbC8vRU4iPgo8aHRtbD4KICAKICA8aGVhZD4KICA8c2NyaXB0IGRlZmVyIGRhdGEtZG9tYWluPSJvZWlzLm9yZyIgc3JjPSJodHRwczovL3BsYXVzaWJsZS5pby9qcy9zY3JpcHQuanMiPjwvc2NyaXB0PgogIDxzdHlsZT4KICBib2R5IHsgbWFyZ2luOiAwOyBwYWRkaW5nOiAwOyB9CiAgdHQgeyBmb250LWZhbWlseTogbW9ub3NwYWNlOyBmb250LXNp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WNlbnQiPlJlY2VudHM8L2E+CgogICAgICA8YnI+CgogICAgICA8YSBocmVmPSIvY29tbXVuaXR5Lmh0bWwiPlRoZSBPRUlTIENvbW11bml0eTwvYT4gfAogICAgICBNYWludGFpbmVkIGJ5IDxhIGhyZWY9Imh0dHA6Ly9vZWlzZi5vcmciPlRoZSBPRUlTIEZvdW5kYXRpb24gSW5jLjwvYT4KICAgIDwvY2VudGVyPgoKICAgIDxwPgogICAgPGNlbnRlcj4KICAgPHNwYW4gc3R5bGU9ImZvbnQtZmFtaWx5OiBzYW5zLXNlcmlmOyBmb250LXNpemU6IDgzJTsgZm9udC1zdHlsZTogaXRhbGljIj4KICAgIDxhIGhyZWY9Ii93aWtpL0xlZ2FsX0RvY3VtZW50cyI+CiAgICBMaWNlbnNlIEFncmVlbWVudHMsIFRlcm1zIG9mIFVzZSwgUHJpdmFjeSBQb2xpY3kuCiAgICA8L2E+LgogICAgPC9zcGFuPgogICAgPC9jZW50ZXI+CgogICAgPHA+CiAgICA8Y2VudGVyPgogICAgPGZvbnQgc2l6ZT0tMT5MYXN0IG1vZGlmaWVkIE1heSAxNCAxNzo1MCBFRFQgMjAyNC4gIENvbnRhaW5zIDM3MjUzMyBzZXF1ZW5jZXMuIChSdW5uaW5nIG9uIG9laXM0Lik8L2ZvbnQ+CiAgICA8L2NlbnRlcj4KICAgIDxwPgoKICA8L2JvZHk+CjwvaHRtbD4K'

I left the test as-is because I'd guessed the banner would be removed by the time we were ready to merge.

@gwhitney
Copy link
Collaborator

Can we change the test in some way? We don't really want our tests susceptible to such vagaries in the site...

Aaron Fenyes added 2 commits May 21, 2024 17:31
Instead of checking most of the logged response, just check the first
few headers, up to the 'Date:' key.
@Vectornaut
Copy link
Collaborator Author

The nonexistent sequence test now checks only the very beginning of the logged response: the first few headers, up to the Date: key.

@gwhitney
Copy link
Collaborator

Tests now pass here. Will finish review asap.

@gwhitney
Copy link
Collaborator

Sorry that ended up being piecemeal as opposed to a single review; I went in presuming the ultimate comment count would be smaller. Anyhow, thanks for your patience, I think I have been through everything now. The performance seems quite solid, just some code formatting/commenting/factoring points. I've posted all the comments I have and as soon as we get them resolved, this should be good to merge.

@Vectornaut
Copy link
Collaborator Author

This should be ready for review again! I've added a comment to each open conversation that I've addressed.

@gwhitney
Copy link
Collaborator

OK this is looking pretty good. All of the previously open points appear to have been addressed. I haven't been able to get it to crash or anything by repeatedly requesting the Virahanka-Fibonacci (A000045) metadata -- although it also hasn't yet run long enough to have grabbed all that data.

Sadly, there is still a bug, although I am not sure whether or not it's a new bug; it's a bit of a pain to go back and forth and try the following in main to see if it works there, but if you need me to do that just let me know. In any case, it would be great to fix this before merging:

If you start the server with the code in this PR (using flask run) and then access the name and values endpoint for a sequence that has never been requested before -- the exact URL I used was http://127.0.0.1:5000/api/get_oeis_name_and_values/A000002 -- you get back just the text Error: Expecting value: line 2 column 1 (char 1) in the browser window. Note that if you first visit http://127.0.0.1:5000/api/get_oeis_values/A000002/100 and then the name_and_values URL, it appears to work fine.

@gwhitney
Copy link
Collaborator

On the plus side, after a couple hours, the code in this PR did manage to collect all 5701 backreferences to A000045, and in the meantime I never caught it having any trouble with other requests, including other requests concerning A000045. So things appear to be working well, and the only obstacle I know of to merging this is the name_and_values error described in the previous comment.

@gwhitney
Copy link
Collaborator

OK, I am going to go ahead and merge this, because I think there is a good chance that the next PR will fix the one remaining issue in this PR, and we need a working backend to make progress with the frontend.

Copy link
Collaborator

@gwhitney gwhitney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been extensively reviewed over a long period, and there is a known remaining bug, but I think that bug is addressed by the next PR and even if not, we can fix it before merging that PR. So approving.

@gwhitney gwhitney merged commit 789bda4 into numberscope:main Jul 18, 2024
Vectornaut pushed a commit that referenced this pull request Jul 20, 2024
This is a single-commit version of #135. It addresses #133 by changing the search query in `get_oeis_name_and_values`. The Requests library automatically URL-encodes the query, so the `:` in the query gets sent as `%3A`.

This pull request is based on #127, which should be merged first. The history associated with this pull request starts at commit 1eec7cd.
Vectornaut pushed a commit to Vectornaut/backscope that referenced this pull request Sep 24, 2024
This addresses issue numberscope#154, using the same technique as PR numberscope#127.
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.

3 participants