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

PARI stack overflows when factoring at doc endpoint #129

Open
katestange opened this issue Apr 22, 2024 · 0 comments
Open

PARI stack overflows when factoring at doc endpoint #129

katestange opened this issue Apr 22, 2024 · 0 comments

Comments

@katestange
Copy link
Member

I'm not sure if this is related or different from #70 but on a fresh DB right now on my system, the endpoint http://127.0.0.1:5000/api/get_oeis_factors/A006862/50 from the documentation will cause the following error:

  ***   Warning: increasing stack size to 8003584.
/home/katestange/data/projects/numberscope/frontscope-backscope/backscope/flaskr/nscope/views.py:301: RuntimeWarning: cypari2 leaked 8005128 bytes on the PARI stack
  seq = fetch_factors(valid_oeis_id, wants)
[2024-04-21 22:06:43,571] ERROR in app: Exception on /api/get_oeis_factors/A006862/50 [GET]
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 301, in get_oeis_factors
    seq = fetch_factors(valid_oeis_id, wants)
  File "/home/katestange/data/projects/numberscope/frontscope-backscope/backscope/flaskr/nscope/views.py", line 182, in fetch_factors
    fac = gen_to_python(pari(val).factor())
  File "cypari2/gen.pyx", line 4363, in cypari2.gen.Gen.factor
  File "cypari2/handle_error.pyx", line 211, in cypari2.handle_error._pari_err_handle
cypari2.handle_error.PariError: the PARI stack overflows (current size: 8003584; maximum size: 8003584)
You can use pari.allocatemem() to change the stack size and try again
Exception on /api/get_oeis_factors/A006862/50 [GET]
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 301, in get_oeis_factors
    seq = fetch_factors(valid_oeis_id, wants)
  File "/home/katestange/data/projects/numberscope/frontscope-backscope/backscope/flaskr/nscope/views.py", line 182, in fetch_factors
    fac = gen_to_python(pari(val).factor())
  File "cypari2/gen.pyx", line 4363, in cypari2.gen.Gen.factor
  File "cypari2/handle_error.pyx", line 211, in cypari2.handle_error._pari_err_handle
cypari2.handle_error.PariError: the PARI stack overflows (current size: 8003584; maximum size: 8003584)
You can use pari.allocatemem() to change the stack size and try again
127.0.0.1 - - [21/Apr/2024 22:06:43] "GET /api/get_oeis_factors/A006862/50 HTTP/1.1" 500 -
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

No branches or pull requests

1 participant