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

internal server error when querying some comments #4155

Closed
decathorpe opened this issue Nov 16, 2020 · 3 comments · Fixed by #4157
Closed

internal server error when querying some comments #4155

decathorpe opened this issue Nov 16, 2020 · 3 comments · Fixed by #4157

Comments

@decathorpe
Copy link

I'm getting this HTTP 500 Internal Server Error when querying comments on bodhi.fedoraproject.org:

500 Internal Server Error

Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/pyramid_mako/init.py", line 148, in call result = template.render_unicode(**system) File "/usr/lib/python3.8/site-packages/mako/template.py", line 481, in render_unicode return runtime._render( File "/usr/lib/python3.8/site-packages/mako/runtime.py", line 878, in _render _render_context( File "/usr/lib/python3.8/site-packages/mako/runtime.py", line 920, in _render_context _exec_template(inherit, lclcontext, args=args, kwargs=kwargs) File "/usr/lib/python3.8/site-packages/mako/runtime.py", line 947, in exec_template callable(context, *args, **kwargs) File "master_html", line 132, in render_body File "/usr/local/lib/python3.8/site-packages/bodhi/server/templates/comments.html", line 44, in render_body ${fragments.comment(comment)} File "fragments_html", line 174, in render_comment AttributeError: 'NoneType' object has no attribute 'get_url'

Looks like there are some invalid Comment objects in the bodhi database, where a field that should be NOT NULL is NULL.

For example: https://bodhi.fedoraproject.org/comments/?rows_per_page=5&page=1136

As far as I can tell, the page numbers (when querying with rows_per_page=5) that trigger this issue are 1136, 1138, 1141, 1142, 1147, 1148, 1149, 1150, 1151, 1152, 1153, 1183, 1184, 1188, and 1190. That does not pinpoint the problematic comments exactly, but should get you close to what's wrong.

@mattiaverga
Copy link
Contributor

It looks like we have a bunch of comments that are not assigned to their update object:

>>> com = m.Comment.query.filter_by(update=None).all()
>>> len(com)
54

(that's from my vagrant Bodhi, the latest database dump seems to be 3 weeks old)

This is something that must not happen. Maybe we should drop the buggy comments and set the update_id column in the comments table to be not nullable, since it already has index=True set.

@decathorpe
Copy link
Author

Yeah, I thought that something like this might be the cause. Setting update_id to NOT NULL and removing the broken entries seems to be a good idea 👍

@decathorpe
Copy link
Author

Thank you for the fix! 👍

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 a pull request may close this issue.

2 participants