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

Issue manually creating book with cover image and importing books via search from other instances and databases #3351

Open
marcusyoung opened this issue Apr 7, 2024 · 16 comments
Labels
bug Something isn't working

Comments

@marcusyoung
Copy link

marcusyoung commented Apr 7, 2024

Describe the bug
More often than not importing from other catalogues in search fails with the error "Server Error
Something went wrong! Sorry about this." The same error occurs when creating a new book with a cover image, or attaching an image to an existing book.

Expected behavior
Book to be import

Instance
ramblingreaders.org

Additional context
Problem only arose after upgrade from 0.6.6 to 0.7.3

@marcusyoung marcusyoung added the bug Something isn't working label Apr 7, 2024
@mouse-reeve
Copy link
Member

Is it possible to get a stack trace on any of these? They should be available in Flower or the celery logs

@dato
Copy link
Contributor

dato commented Apr 8, 2024

I think I've diagnosed this, and will be submitting a fix shortly.

It's due to #3273 allowing pages to be strings, whereas one of the pure_content() method still assumes they're int:

  File ".../bookwyrm/models/status.py", line 398, in _format_position
    return f"pp. {beg}-{end}" if end > beg else f"p. {beg}"
TypeError: '>' not supported between instances of 'int' and 'str'

@dato
Copy link
Contributor

dato commented Apr 8, 2024

I think I've diagnosed this,

Whoops, this message was meant for #3352 instead..

@marcusyoung
Copy link
Author

marcusyoung commented Apr 8, 2024

Is it possible to get a stack trace on any of these? They should be available in Flower or the celery logs

I'm not sure how to get to the Flower or celery logs (dockerless install). I have this in the bookwyrm service logs for a failed import. Is that on any use?

Apr 08 22:51:16 izzy.graspit.co.uk gunicorn[11256]: OK: /book/378729/s/water-in-plain-sight
Apr 08 22:51:16 izzy.graspit.co.uk gunicorn[11256]: Traceback (most recent call last):
Apr 08 22:51:16 izzy.graspit.co.uk gunicorn[11256]:   File "/opt/bookwyrm/venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 47, in inner
Apr 08 22:51:16 izzy.graspit.co.uk gunicorn[11256]:     response = get_response(request)
Apr 08 22:51:16 izzy.graspit.co.uk gunicorn[11256]:   File "/opt/bookwyrm/venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 204, in _get_response
Apr 08 22:51:16 izzy.graspit.co.uk gunicorn[11256]:     response = response.render()
Apr 08 22:51:16 izzy.graspit.co.uk gunicorn[11256]:   File "/opt/bookwyrm/venv/lib/python3.10/site-packages/django/template/response.py", line 105, in render
Apr 08 22:51:16 izzy.graspit.co.uk gunicorn[11256]:     self.content = self.rendered_content
Apr 08 22:51:16 izzy.graspit.co.uk gunicorn[11256]:   File "/opt/bookwyrm/venv/lib/python3.10/site-packages/django/template/response.py", line 83, in rendered_content
Apr 08 22:51:16 izzy.graspit.co.uk gunicorn[11256]:     return template.render(context, self._request)

@marcusyoung marcusyoung changed the title Issue importing books via search from other instances and databases Issue creating books and importing books via search from other instances and databases Apr 9, 2024
@marcusyoung
Copy link
Author

marcusyoung commented Apr 9, 2024

@mouse-reeve it appears this issue is also preventing any new books from being created. In particular if a cover image is added to the book. Or if attempt to add a cover to an existing book.

@marcusyoung marcusyoung changed the title Issue creating books and importing books via search from other instances and databases Issue manually creating book with cover image and importing books via search from other instances and databases Apr 9, 2024
@marcusyoung
Copy link
Author

@mouse-reeve Do you think there would be any implications if I checkout version 0.7.2 instead? Any database changes in 0.7.3 that would cause an issue?

@Minnozz
Copy link
Contributor

Minnozz commented Apr 10, 2024

@mouse-reeve Do you think there would be any implications if I checkout version 0.7.2 instead? Any database changes in 0.7.3 that would cause an issue?

Before checking out 0.7.2, you can revert the database migrations included in 0.7.3:

./bw-dev migrate bookwyrm 0192_sitesettings_user_exports_enabled

@marcusyoung
Copy link
Author

@mouse-reeve Do you think there would be any implications if I checkout version 0.7.2 instead? Any database changes in 0.7.3 that would cause an issue?

Before checking out 0.7.2, you can revert the database migrations included in 0.7.3:

./bw-dev migrate bookwyrm 0192_sitesettings_user_exports_enabled

Is that ok with a dockerless install?

@Minnozz
Copy link
Contributor

Minnozz commented Apr 10, 2024

Is that ok with a dockerless install?

For a dockerless install, you would need the following command:

venv/bin/python3 manage.py migrate bookwyrm 0192_sitesettings_user_exports_enabled

@marcusyoung
Copy link
Author

Is that ok with a dockerless install?

For a dockerless install, you would need the following command:

venv/bin/python3 manage.py migrate bookwyrm 0192_sitesettings_user_exports_enabled

Tried this, and although it appeared to revert database changes, when I tried to bring Bookwyrm back up it failed. Journalctl showed errors about missing columns etc. So have had to go back to 0.7.3.

@marcusyoung
Copy link
Author

More information. The problem seems to be specifically related to creating or importing (from search) books that have a cover image. If that can help anyone narrow things down?

@marcusyoung
Copy link
Author

What information can I provide to expediate a fix for this?

@Minnozz
Copy link
Contributor

Minnozz commented Apr 11, 2024

This was discussed further on Matrix; most likely this is the same issue as #3342

@marcusyoung will try to manually apply that fix and report back if it works.

@maxheadroom
Copy link
Contributor

maxheadroom commented Apr 11, 2024

I have the same issue. I've manually reverted the DB migrations from 0.7.3 but still run into the issue that searching for stuff results in a Server Error if the search content can't be found locally.. Which Matrix room are you using?

When searching remote libraries/catalogs the server returns an error after ~ 15 seconds. I can see that it's contacting other instances in the Background. But the Frontend seems to have a timeout of 15 seconds. I believe this is related to the import issue discussed here.

@Minnozz
Copy link
Contributor

Minnozz commented Apr 11, 2024

I have the same issue. I've manually reverted the DB migrations from 0.7.3 but still run into the issue that searching for stuff results in a Server Error if the search content can't be found locally.. Which Matrix room are you using?

The Matrix room is https://matrix.to/#/%23bookwyrm%3Amatrix.org

When searching remote libraries/catalogs the server returns an error after ~ 15 seconds. I can see that it's contacting other instances in the Background. But the Frontend seems to have a timeout of 15 seconds. I believe this is related to the import issue discussed here.

If your issue is the same as the one discussed here, and you also run a setup without Docker, you can try removing and recreating the Python venv as a workaround

@marcusyoung
Copy link
Author

This was discussed further on Matrix; most likely this is the same issue as #3342

@marcusyoung will try to manually apply that fix and report back if it works.

I have made the change to requirements.txt and installed the new requirement. This appears to have fixed the problem. I'll await user feedback to be sure. I didn't do a new .venv at this time, as I need to prepare for that and to be sure there won't be any issues installing Python 3.11 (which isn't officially supported on jammy).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants