fedora-infra / anitya

A cross-distribution upstream release monitoring project
https://release-monitoring.org
GNU General Public License v2.0
245 stars 104 forks source link

500 when accessing https://release-monitoring.org/project/155688/ #1590

Closed Zlopez closed 1 year ago

Zlopez commented 1 year ago
[Mon May 22 07:55:45.397382 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] File "/usr/local/lib/python3.11/site-packages/anitya/lib/versions/python.py", line 63, in version_object
[Mon May 22 07:55:45.397385 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] return packaging.version.Version(version)
[Mon May 22 07:55:45.397389 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[Mon May 22 07:55:45.397391 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] File "/usr/lib/python3.11/site-packages/packaging/version.py", line 197, in __init__
[Mon May 22 07:55:45.397394 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] raise InvalidVersion(f"Invalid version: '{version}'")
[Mon May 22 07:55:45.397396 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] packaging.version.InvalidVersion: Invalid version: 'unstable'
[Mon May 22 07:55:45.397398 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014]
[Mon May 22 07:55:45.397401 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] The above exception was the direct cause of the following exception:
[Mon May 22 07:55:45.397403 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014]
[Mon May 22 07:55:45.397405 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] Traceback (most recent call last):
[Mon May 22 07:55:45.397407 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] File "/usr/lib/python3.11/site-packages/flask/app.py", line 2528, in wsgi_app
[Mon May 22 07:55:45.397410 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] response = self.full_dispatch_request()
[Mon May 22 07:55:45.397412 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[Mon May 22 07:55:45.397414 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] File "/usr/lib/python3.11/site-packages/flask/app.py", line 1825, in full_dispatch_request
[Mon May 22 07:55:45.397416 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] rv = self.handle_user_exception(e)
[Mon May 22 07:55:45.397439 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[Mon May 22 07:55:45.397442 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] File "/usr/lib/python3.11/site-packages/flask/app.py", line 1823, in full_dispatch_request
[Mon May 22 07:55:45.397444 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] rv = self.dispatch_request()
[Mon May 22 07:55:45.397446 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] ^^^^^^^^^^^^^^^^^^^^^^^
[Mon May 22 07:55:45.397448 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] File "/usr/lib/python3.11/site-packages/flask/app.py", line 1799, in dispatch_request
[Mon May 22 07:55:45.397451 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
[Mon May 22 07:55:45.397453 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[Mon May 22 07:55:45.397455 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] File "/usr/local/lib/python3.11/site-packages/anitya/ui.py", line 115, in project
[Mon May 22 07:55:45.397457 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] return flask.render_template(
[Mon May 22 07:55:45.397459 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] ^^^^^^^^^^^^^^^^^^^^^^
[Mon May 22 07:55:45.397461 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] File "/usr/lib/python3.11/site-packages/flask/templating.py", line 147, in render_template
[Mon May 22 07:55:45.397464 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] return _render(app, template, context)
[Mon May 22 07:55:45.397472 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] ^^^^^^^^^^^^^^^^^^^^^^^^
[Mon May 22 07:55:45.397474 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] File "/usr/lib/python3.11/site-packages/jinja2/environment.py", line 1291, in render
[Mon May 22 07:55:45.397477 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] self.environment.handle_exception()
[Mon May 22 07:55:45.397479 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] File "/usr/lib/python3.11/site-packages/jinja2/environment.py", line 925, in handle_exception
[Mon May 22 07:55:45.397481 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] raise rewrite_traceback_stack(source=source)
[Mon May 22 07:55:45.397483 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] File "/usr/local/lib/python3.11/site-packages/anitya/templates/project.html", line 1, in top-level template code
[Mon May 22 07:55:45.397485 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] {% extends "master.html" %}
[Mon May 22 07:55:45.397488 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] ^^^^^^^^^^^^^^^^^^^^^^^^^
[Mon May 22 07:55:45.397490 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] File "/usr/local/lib/python3.11/site-packages/anitya/templates/master.html", line 171, in top-level template code
[Mon May 22 07:55:45.397492 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] {% block body %}{% endblock %}
[Mon May 22 07:55:45.397494 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] ^^^^^^^^^^^^^^^^^^^^^^^^^
[Mon May 22 07:55:45.397496 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] File "/usr/local/lib/python3.11/site-packages/anitya/templates/project.html", line 292, in block 'body'
[Mon May 22 07:55:45.397502 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] <td property="doap:revision">{{ version.parse() }}</td>
[Mon May 22 07:55:45.397504 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] ^^^^^^^^^^^^^^^^^^^^^^^^^
[Mon May 22 07:55:45.397506 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] File "/usr/local/lib/python3.11/site-packages/anitya/lib/versions/python.py", line 71, in parse
[Mon May 22 07:55:45.397508 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] return str(self.version_object())
[Mon May 22 07:55:45.397510 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] ^^^^^^^^^^^^^^^^^^^^^
[Mon May 22 07:55:45.397512 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] File "/usr/local/lib/python3.11/site-packages/anitya/lib/versions/python.py", line 65, in version_object
[Mon May 22 07:55:45.397515 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] raise base.InvalidVersion(str(e)) from e
[Mon May 22 07:55:45.397517 2023] [wsgi:error] [pid 6446:tid 6449] [client 10.128.4.1:43014] anitya.lib.exceptions.InvalidVersion: Invalid version "Invalid version: 'unstable'"
Zlopez commented 1 year ago

This is caused when the Python version scheme is used and the version is not a version at all (in this case, it's string unstable). Instead of getting string the exception is thrown, so the correct fix for this is to gracefully handle the exception.