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

Some media objects fail to load with a 502 error #126

Open
EvilCartyen opened this issue Nov 4, 2022 · 8 comments
Open

Some media objects fail to load with a 502 error #126

EvilCartyen opened this issue Nov 4, 2022 · 8 comments
Labels
question Further information is requested

Comments

@EvilCartyen
Copy link

I have just recently set up Gramps Web hosted on an old work pc running Linux Mint. I am very new to docker, but eventually got everything set up and working with SSL as per the suggested method in the documentation.

I moved over my tree and media files from my local installation (manually deployed, not via the sync extension), but I am experiencing some issues with media objects - only some are being read correctly from the server:
image

Inspecting the page with the media object I can see they fail with 502 Bad Gateway.

image

I looked at the files and I can't really find any pattern as to what fails. Doesn't seem to be related to file format, size, or naming.

@DavidMStraub
Copy link
Member

Could it be that the ones that don't work have absolute paths rather than relative ones?

@EvilCartyen
Copy link
Author

I don't think so, but I don't know how to check it in the Gramps Web app :)

I am also experiencing a possibly related issue where previews/thumbnails for some of the media files load on first load, but not when use the tile view navigation buttons. It smells like a general bug with loading media objects, but I am not a programmer and I can't really investigate further on my own.

I'd be happy to let a developer take a look to investigate, just shoot me a message. I am well aware that Gramps Web is not released, and I'd like to contribute where I can.

@DavidMStraub
Copy link
Member

Can you please check the logs with docker-compose logs grampsweb? This should show the Python errors emitted by Web API (this is almost certainly a backend issue).

@EvilCartyen
Copy link
Author

You're right, it seems to be absolute paths - at least some of the time. Logs show errors like this:

grampsweb_1 | FileNotFoundError: [Errno 2] No such file or directory: '/app/media/C:/gramps-media/NielsMikkelsenKelstrupFamilie.jpg' grampsweb_1 | [2022-11-04 09:22:01 +0000] [13] [ERROR] Socket error processing request. grampsweb_1 | Traceback (most recent call last): grampsweb_1 | File "/usr/local/lib/python3.9/dist-packages/gunicorn/workers/sync.py", line 136, in handle grampsweb_1 | self.handle_request(listener, req, client, addr) grampsweb_1 | File "/usr/local/lib/python3.9/dist-packages/gunicorn/workers/sync.py", line 194, in handle_request grampsweb_1 | util.reraise(*sys.exc_info()) grampsweb_1 | File "/usr/local/lib/python3.9/dist-packages/gunicorn/util.py", line 626, in reraise grampsweb_1 | raise value grampsweb_1 | File "/usr/local/lib/python3.9/dist-packages/gunicorn/workers/sync.py", line 179, in handle_request grampsweb_1 | respiter = self.wsgi(environ, resp.start_response) grampsweb_1 | File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2548, in __call__ grampsweb_1 | return self.wsgi_app(environ, start_response) grampsweb_1 | File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2528, in wsgi_app grampsweb_1 | response = self.handle_exception(e) grampsweb_1 | File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2525, in wsgi_app grampsweb_1 | response = self.full_dispatch_request() grampsweb_1 | File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1822, in full_dispatch_request grampsweb_1 | rv = self.handle_user_exception(e) grampsweb_1 | File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1820, in full_dispatch_request grampsweb_1 | rv = self.dispatch_request() grampsweb_1 | File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1796, in dispatch_request grampsweb_1 | return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) grampsweb_1 | File "/usr/local/lib/python3.9/dist-packages/gramps_webapi/api/auth.py", line 45, in wrapper grampsweb_1 | return func(*args, **kwargs) grampsweb_1 | File "/usr/local/lib/python3.9/dist-packages/webargs/core.py", line 594, in wrapper grampsweb_1 | return func(*args, **kwargs) grampsweb_1 | File "/usr/local/lib/python3.9/dist-packages/flask_caching/__init__.py", line 404, in decorated_function grampsweb_1 | rv = self._call_fn(f, *args, **kwargs) grampsweb_1 | File "/usr/local/lib/python3.9/dist-packages/flask_caching/__init__.py", line 180, in _call_fn grampsweb_1 | return ensure_sync(fn)(*args, **kwargs) grampsweb_1 | File "/usr/local/lib/python3.9/dist-packages/gramps_webapi/api/__init__.py", line 313, in get_thumbnail grampsweb_1 | return handler.send_thumbnail(size=size, square=args["square"]) grampsweb_1 | File "/usr/local/lib/python3.9/dist-packages/gramps_webapi/api/file.py", line 176, in send_thumbnail grampsweb_1 | thumb = LocalFileThumbnailHandler(self.path_abs, self.mime) grampsweb_1 | File "/usr/local/lib/python3.9/dist-packages/gramps_webapi/api/image.py", line 210, in __init__ grampsweb_1 | with open(self.path, "rb") as f:

There's no way to fix this from within Gramps Web, is there? It would also be useful to be able to delete media objects...

Once I've found a way to fix the paths I'd like to see if the browsing issue goes away in the tiles view. Could be a different issue, since images are sometimes loaded correctly.

@DavidMStraub
Copy link
Member

There's no way to fix this from within Gramps Web, is there?

No, the easiest way right now is to use the Media Manager in desktop to convert absolute to relative paths.

It would also be useful to be able to delete media objects...

This is tracked in #119.

@DavidMStraub
Copy link
Member

Another thing to check is whether you have Windows (backslash) paths: gramps-project/gramps-web-api#187

@DavidMStraub
Copy link
Member

I guess this specific error could also be solved by implementing gramps-project/gramps-web-api#151, i.e. auto-converting absolute media paths to the new base directory. Let me know if changing to relative paths solved the issue.

@EvilCartyen
Copy link
Author

Thank you for all your suggestions, I haven't had time to look at the issue again yet, but I will update and close this when I do 🙂

@DavidMStraub DavidMStraub added the question Further information is requested label Dec 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants