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 with any user related interaction on newest release #115

Closed
duckpuppy opened this issue Jan 19, 2021 · 12 comments · Fixed by #116
Closed

Internal Server Error with any user related interaction on newest release #115

duckpuppy opened this issue Jan 19, 2021 · 12 comments · Fixed by #116

Comments

@duckpuppy
Copy link

duckpuppy commented Jan 19, 2021

linuxserver.io


Expected Behavior

Clicking on a user in the admin interface, creating a new user using the UI button, or clicking your logged-in user name to view your profile and settings should work.

Current Behavior

Application returns an Internal Server Error (500) response.

Steps to Reproduce

  1. Update to image ID to the one currently tagged latest
  2. Log in as an admin user
  3. Access the admin interface
  4. Try to create a new user

Environment

OS: Debian Buster
CPU architecture: x86_64
How docker service was installed: Installed from Docker Hub

Command used to create docker container (run/create/compose/screenshot)

Created via the docker puppet module
Relevant bit of create script (container is recreated each time the service starts by the script removing the existing one):

/usr/bin/docker rm  calibre-web >/dev/null 2>&1
/usr/bin/docker create \
--net traefik \
-m 0b \
-e "PUID=998" \
 \
-e "PGID=997" \
 \
-e "TZ=America/New_York" \
 \
-e "DOCKER_MODS=linuxserver/calibre-web:calibre" \
 \
-l traefik.enable=true \
 \
...
<Other traefik config labels removed>
...
 \
-v /srv/etc/calibre-web:/config \
 \
-v /srv/media/ebooks:/books:ro \
 \
--name calibre-web \
linuxserver/calibre-web:latest \

Docker logs

The docker logs are free of errors. However, this is what is shown in the browser (for trying to create a new user, but the final cause is the same in all cases)

Calibre-web
Internal Server Error
500 Internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
Traceback (most recent call last):
File "/app/calibre-web/cps/db.py", line 713, in speaking_language
cur_l = LC.parse(lang.lang_code)
File "/usr/local/lib/python3.8/dist-packages/babel/core.py", line 331, in parse
raise UnknownLocaleError(input_id)
babel.core.UnknownLocaleError: unknown locale 'ale'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.8/dist-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python3.8/dist-packages/flask_login/utils.py", line 272, in decorated_view
return func(*args, **kwargs)
File "/app/calibre-web/cps/admin.py", line 90, in inner
return f(*args, **kwargs)
File "/app/calibre-web/cps/admin.py", line 1108, in new_user
languages = calibre_db.speaking_language()
File "/app/calibre-web/cps/db.py", line 716, in speaking_language
lang.name = _(isoLanguages.get(part3=lang.lang_code).name)
File "/usr/local/lib/python3.8/dist-packages/iso639/iso639.py", line 265, in get
return getattr(self, key)[value]
File "/usr/local/lib/python3.8/dist-packages/iso639/iso639.py", line 105, in __get__
val = self.f(instance)
File "/usr/local/lib/python3.8/dist-packages/iso639/iso639.py", line 186, in part3
return dict((x.part3, x) for x in self.languages if x.part3)
File "/usr/local/lib/python3.8/dist-packages/iso639/iso639.py", line 105, in __get__
val = self.f(instance)
File "/usr/local/lib/python3.8/dist-packages/iso639/iso639.py", line 174, in languages
l, i, m, p5, p2, p1 = _fabtabular()
File "/usr/local/lib/python3.8/dist-packages/iso639/iso639.py", line 20, in _fabtabular
from pkg_resources import resource_filename
ModuleNotFoundError: No module named 'pkg_resources'

It's always not being able to find pkg_resources, which Google tells me is a faulty or missing setuptools install.

@project-bot project-bot bot added this to To do in Issue & PR Tracker Jan 19, 2021
@github-actions
Copy link

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

@CHBMB
Copy link
Member

CHBMB commented Jan 19, 2021

Hi, I'm afraid I can't reproduce this. Running standard docker/docker-compose on Ubuntu 20.04

I've just spun up a new container, new /config and logged in as admin and created a new user without any issues at all.

That's with no reverse proxy in front of it, then I tried again with my Nginx reverse proxy in front of it. I tried with and without the calibre mod as well and it's not throwing any issues for me.

For good measure I tried with my usual container which has a LDAP backend and I was also able to create a local user without any problems.

Only thing I can suggest is to try without Traefik as it's the only difference that springs to mind although I acknowledge that the errors don't "scream out" that that's the cause of the isssue.

Screenshot

@duckpuppy
Copy link
Author

I've been running this image for a long time (keeping up with latest) using traefik, and this is a first for me - I've never had this error until this image.

I can reliably fix the problem by changing the script I posted above to use linuxserver/calibre-web:0.6.9, and can reliably reproduce it on linuxserver/calibre-web:0.6.10. There's something going on between those images... I'll see if I can test it without traefik.

@duckpuppy
Copy link
Author

It was easier than I thought to test without traefik - I updated the script to remove the --net traefik and added -p 8093:8083 in it's place (I have something on 8083 on the docker host already). Navigating to http://:8093 gives me the same error.

@CHBMB
Copy link
Member

CHBMB commented Jan 19, 2021

Yeah, I've been running it myself since it was released. I still can't reproduce it here though.

This looks relevant

@aptalca
Copy link
Member

aptalca commented Jan 19, 2021

Why do you have the /books mount as read only? I thought calibre-web wrote to it

@duckpuppy
Copy link
Author

Same errors - missing packages has to be something in the image/container, right?

[2021-01-19 16:29:05,233] ERROR {cps:1891} Exception on /admin/user/1 [GET]
Traceback (most recent call last):
  File "/app/calibre-web/cps/db.py", line 713, in speaking_language
    cur_l = LC.parse(lang.lang_code)
  File "/usr/local/lib/python3.8/dist-packages/babel/core.py", line 331, in parse
    raise UnknownLocaleError(input_id)
babel.core.UnknownLocaleError: unknown locale 'ale'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.8/dist-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.8/dist-packages/flask_login/utils.py", line 272, in decorated_view
    return func(*args, **kwargs)
  File "/app/calibre-web/cps/admin.py", line 90, in inner
    return f(*args, **kwargs)
  File "/app/calibre-web/cps/admin.py", line 1176, in edit_user
    languages = calibre_db.speaking_language()
  File "/app/calibre-web/cps/db.py", line 716, in speaking_language
    lang.name = _(isoLanguages.get(part3=lang.lang_code).name)
  File "/usr/local/lib/python3.8/dist-packages/iso639/iso639.py", line 265, in get
    return getattr(self, key)[value]
  File "/usr/local/lib/python3.8/dist-packages/iso639/iso639.py", line 105, in __get__
    val = self.f(instance)
  File "/usr/local/lib/python3.8/dist-packages/iso639/iso639.py", line 186, in part3
    return dict((x.part3, x) for x in self.languages if x.part3)
  File "/usr/local/lib/python3.8/dist-packages/iso639/iso639.py", line 105, in __get__
    val = self.f(instance)
  File "/usr/local/lib/python3.8/dist-packages/iso639/iso639.py", line 174, in languages
    l, i, m, p5, p2, p1 = _fabtabular()
  File "/usr/local/lib/python3.8/dist-packages/iso639/iso639.py", line 20, in _fabtabular
    from pkg_resources import resource_filename
ModuleNotFoundError: No module named 'pkg_resources'
[2021-01-19 16:31:27,130] ERROR {cps:1891} Exception on /admin/user/new [GET]
Traceback (most recent call last):
  File "/app/calibre-web/cps/db.py", line 713, in speaking_language
    cur_l = LC.parse(lang.lang_code)
  File "/usr/local/lib/python3.8/dist-packages/babel/core.py", line 331, in parse
    raise UnknownLocaleError(input_id)
babel.core.UnknownLocaleError: unknown locale 'ale'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.8/dist-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.8/dist-packages/flask_login/utils.py", line 272, in decorated_view
    return func(*args, **kwargs)
  File "/app/calibre-web/cps/admin.py", line 90, in inner
    return f(*args, **kwargs)
  File "/app/calibre-web/cps/admin.py", line 1108, in new_user
    languages = calibre_db.speaking_language()
  File "/app/calibre-web/cps/db.py", line 716, in speaking_language
    lang.name = _(isoLanguages.get(part3=lang.lang_code).name)
  File "/usr/local/lib/python3.8/dist-packages/iso639/iso639.py", line 265, in get
    return getattr(self, key)[value]
  File "/usr/local/lib/python3.8/dist-packages/iso639/iso639.py", line 105, in __get__
    val = self.f(instance)
  File "/usr/local/lib/python3.8/dist-packages/iso639/iso639.py", line 186, in part3
    return dict((x.part3, x) for x in self.languages if x.part3)
  File "/usr/local/lib/python3.8/dist-packages/iso639/iso639.py", line 105, in __get__
    val = self.f(instance)
  File "/usr/local/lib/python3.8/dist-packages/iso639/iso639.py", line 174, in languages
    l, i, m, p5, p2, p1 = _fabtabular()
  File "/usr/local/lib/python3.8/dist-packages/iso639/iso639.py", line 20, in _fabtabular
    from pkg_resources import resource_filename
ModuleNotFoundError: No module named 'pkg_resources'

@duckpuppy
Copy link
Author

There's an unknown locale error there too, but I have no idea where it's coming from.

@CHBMB
Copy link
Member

CHBMB commented Jan 19, 2021

@duckpuppy Might be worth opening an issue upstream. The packages we install haven't changed and the python packages we use are all defined in requirements.txt and optional-requirements.txt from Calibre-web

@duckpuppy
Copy link
Author

That issue does look related, down to the language error.

I have /books read-only because I don't want calibre-web making changes. Calibre is running in another container and I don't want calibre-web messing with things.

@duckpuppy
Copy link
Author

I found the issue, and it's in Calibre-web and is also not present in 0.6.9 for some reason. The source location in the locale error above points to code in Calibre-web that populates a drop-down in the user form containing all the languages of all books in the database. I reverted to the 0.6.9 image and pulled up a user to see that list - it contained the Aleut language. I used Calibre to find books with that language and changed the language to English. The latest calibre-web image works now. It appears that somehow the ale locale was supported in 0.6.9, but not in 0.6.10 - likely an issue for one of the dependencies. I've opened an issue with calibre-web to look into it... since if someone legitimately has books in the Aleut language it might be a problem.

Issue & PR Tracker automation moved this from To do to Done Jan 19, 2021
@CHBMB
Copy link
Member

CHBMB commented Jan 19, 2021

I'm going to be honest, I had to look at Wikipedia to even find out what Aleut was. Interesting. Now I've got something to go on I'll have a play here.

CHBMB added a commit that referenced this issue Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

3 participants