linuxserver / docker-lazylibrarian

GNU General Public License v3.0
84 stars 25 forks source link

[BUG] 500 Internal server error when visiting http://myserver:5299/config #75

Open dsbrown opened 1 month ago

dsbrown commented 1 month ago

Is there an existing issue for this?

Current Behavior

When you go to the web address http://myserver.local:5299/config, at least the first time it works. Then you edit the download agent and hit save changes, you get a 500 error and it never resets, you get the error over and over again when you go to /config. So, you can never go to /config again. The rest works fine i.e http://myserver.local:5299/authors displays an empty authors page, etc.

This seems to be similar the closed issue https://github.com/linuxserver/docker-lazylibrarian/issues/30; but admittedly, a much different debug log.

Expected Behavior

When I hit save changes, It doesn't error, and it saves my config and when I go back to /config, it does give me the 500 error over and over again.

Steps To Reproduce

With the config below, go to the website http://myserver.local:5299/config and get the error:

The server encountered an unexpected condition which prevented it from fulfilling the request.

500 Internal Server Error

The server encountered an unexpected condition which prevented it from fulfilling the request.

Traceback (most recent call last):
  File "/app/lazylibrarian/cherrypy/_cprequest.py", line 670, in respond
    response.body = self.handler()
  File "/app/lazylibrarian/cherrypy/lib/encoding.py", line 217, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/app/lazylibrarian/cherrypy/_cpdispatch.py", line 61, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/app/lazylibrarian/lazylibrarian/webServe.py", line 1721, in config
    namevars = name_vars('test')
  File "/app/lazylibrarian/lazylibrarian/bookrename.py", line 725, in name_vars
    fmtseries = CONFIG['FMT_SERIES'].replace('$SerNum', seriesnum).replace(
  File "/app/lazylibrarian/lazylibrarian/configtypes.py", line 669, in __getitem__
    return self.get_str(__name.upper())
  File "/app/lazylibrarian/lazylibrarian/configtypes.py", line 661, in get_str
    return self.config[key.upper()].get_str()
  File "/app/lazylibrarian/lazylibrarian/configtypes.py", line 76, in get_str
    self._on_read(True)
  File "/app/lazylibrarian/lazylibrarian/configtypes.py", line 144, in _on_read
    logger.debug(f"Read config[{self.key}]={self.value}")
  File "/app/lazylibrarian/lazylibrarian/configtypes.py", line 80, in __str__
    return self.get_str()
  File "/app/lazylibrarian/lazylibrarian/configtypes.py", line 76, in get_str

This is line 26 (the last line above) and then it repeats until line 1184 (the last line below)

  File "/app/lazylibrarian/lazylibrarian/configtypes.py", line 144, in _on_read
    logger.debug(f"Read config[{self.key}]={self.value}")
  File "/app/lazylibrarian/lazylibrarian/configtypes.py", line 80, in __str__
    return self.get_str()
  File "/app/lazylibrarian/lazylibrarian/configtypes.py", line 76, in get_str
    self._on_read(True)
  File "/app/lazylibrarian/lazylibrarian/configtypes.py", line 142, in _on_read
    self.accesses[Access.READ_OK] += 1
RecursionError: maximum recursion depth exceeded while calling a Python object

Powered by CherryPy 3.6.0 

Environment

###  - OS: Linux aserver 6.1.0-23-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.99-1 (2024-07-15) x86_64 GNU/Linux
### - Again, i removed identifying information, mostly my vpn, myservername, the TZ.
### - docker status

systemctl status docker.service
● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; preset: enabled)
     Active: active (running) since Sun 2024-07-21 10:19:27 PDT; 4 days ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 649 (dockerd)
      Tasks: 186
     Memory: 191.8M
        CPU: 8min 57.874s
     CGroup: /system.slice/docker.service
             ├─    649 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
             ├─   1123 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8000 -container-ip 172.19.0.2 -c>
             ├─   1132 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8000 -container-ip 172.19.0.2 -contai>
             ├─   1142 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 9000 -container-ip 172.19.0.2 -c>
             ├─   1156 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 9000 -container-ip 172.19.0.2 -contai>
             ├─   1171 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 9443 -container-ip 172.19.0.2 -c>
             ├─   1194 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 9443 -container-ip 172.19.0.2 -contai>
             ├─   1262 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 13378 -container-ip 172.20.0.2 ->
             ├─   1275 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 13378 -container-ip 172.20.0.2 -conta>
             ├─2733793 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 3000 -container-ip 172.18.0.2 -c>
             ├─2733799 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 3000 -container-ip 172.18.0.2 -contai>
             ├─2733807 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 5299 -container-ip 172.18.0.2 -c>
             ├─2733818 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 5299 -container-ip 172.18.0.2 -contai>
             ├─2733830 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 6881 -container-ip 172.18.0.2 -c>
             ├─2733842 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 6881 -container-ip 172.18.0.2 -contai>
             ├─2733849 /usr/bin/docker-proxy -proto udp -host-ip 0.0.0.0 -host-port 6881 -container-ip 172.18.0.2 -c>
             ├─2733861 /usr/bin/docker-proxy -proto udp -host-ip :: -host-port 6881 -container-ip 172.18.0.2 -contai>
             ├─2733872 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8085 -container-ip 172.18.0.2 -c>
             └─2733883 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8085 -container-ip 172.18.0.2 -contai>

Warning: some journal files were not opened due to insufficient permissions.

Just noticed the journal warning, hopefully that's not related, I will have to look into it.

- Debian docker packages

apt list |grep docker

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

docker-buildx-plugin/bookworm,now 0.15.1-1~debian.12~bookworm amd64 [installed]
docker-ce-cli/bookworm,now 5:27.0.3-1~debian.12~bookworm amd64 [installed]
docker-ce-rootless-extras/bookworm,now 5:27.0.3-1~debian.12~bookworm amd64 [installed,automatic]
docker-ce/bookworm,now 5:27.0.3-1~debian.12~bookworm amd64 [installed]
docker-clean/stable 2.0.4-5 all
docker-compose-plugin/bookworm,now 2.28.1-1~debian.12~bookworm amd64 [installed]
docker-compose/stable 1.29.2-3 all
docker-doc/stable 20.10.24+dfsg1-1 all
docker-registry/stable 2.8.2+ds1-1 amd64
docker-scan-plugin/bookworm 0.23.0~debian-bookworm amd64
docker.io/stable 20.10.24+dfsg1-1+b3 amd64
docker/stable 1.5-2 all
elpa-dockerfile-mode/stable 1.8-1 all
golang-docker-credential-helpers/stable 0.6.4+ds1-1+b6 amd64
golang-github-docker-distribution-dev/stable 2.8.2+ds1-1 all
golang-github-docker-docker-credential-helpers-dev/stable 0.6.4+ds1-1 all
golang-github-docker-docker-dev/stable 20.10.24+dfsg1-1 all
golang-github-docker-go-connections-dev/stable 0.4.0-4 all
golang-github-docker-go-dev/stable 0.0~git20160303.0.d30aec9-3.1 all
golang-github-docker-go-events-dev/stable 0.0~git20190806.e31b211-4 all
golang-github-docker-go-metrics-dev/stable 0.0.1-2 all
golang-github-docker-go-units-dev/stable 0.4.0-4 all
golang-github-docker-leadership-dev/stable 0.1.0-1.1 all
golang-github-docker-libkv-dev/stable 0.2.1-3 all
golang-github-docker-libtrust-dev/stable 0.0~git20150526.0.9cbd2a1-3.1 all
golang-github-docker-notary-dev/stable 0.7.0+ds1-2 all
golang-github-docker-spdystream-dev/stable 0.2.0-1 all
golang-github-fsouza-go-dockerclient-dev/stable 1.8.1-1 all
golang-github-samalba-dockerclient-dev/stable 0.0~git20160531.0.a303626-2 all
kdocker/stable 5.4-1 amd64
libnss-docker/stable 0.02-1.1 amd64
librust-dockerfile-dev/stable 0.2.1-2 amd64
node-is-docker/stable 3.0.0-6 all
ovn-docker/stable 23.03.1-1~deb12u2 amd64
podman-docker/stable 4.3.1+ds1-8+deb12u1 amd64
python3-docker/stable 5.0.3-1 all
python3-dockerpty/stable 0.4.1-4 all
python3-dockerpycreds/stable 0.3.0-1.1 all
ruby-docker-api/stable 2.2.0-1 all
wmdocker/stable 1.5-2 amd64

### CPU architecture

x86-64

### Docker creation

```bash
## - How docker service was installed:
Here is my docker compose, with a few identifying things renamed and TZ removed. I may not have fully configured it correctly, this is my first go at it when it failed.

Note I am going through gluetun because it was my first time installing LazyLibrarian and I wasn't sure how much to trust it until I figure it out more. If this is a problem, I can remove it from the gluetun service and try again. 

x-common: &common
  environment:
    - PUID=1000
    - PGID=1000

name: thething  
services:
  # Gluetun - VPN tunneling service
  gluetun:
    image: qmcgaw/gluetun
    container_name: gluetun
    # line above must be uncommented to allow external containers to connect.
    cap_add:
      - NET_ADMIN  # Required to allow this container to setup the network
    devices:
      - /dev/net/tun:/dev/net/tun
    ports:
      - 3000:3000     # Vuetorrent
      - 6881:6881     # qbittorrent - TORRENTING_PORT  
      - 6881:6881/udp # qbittorrent - tcp/udp connection port
      - 8085:8085     # qbittorrent
      - 5299:5299     # LazyLibrarian
    volumes:
      - /mnt/medea/data/docker/arr-stack/gluetun:/gluetun
    secrets:
      - openvpn_user
      - openvpn_password
    environment:
      - VPN_SERVICE_PROVIDER=myvpnprovider
      - VPN_TYPE=openvpn
      - SERVER_REGIONS="US Anytown"
      - TORRENTING_PORT=6881
      # Server list updater
      - UPDATER_PERIOD=24h
    sysctls:
        - net.ipv4.conf.all.src_valid_mark=1
        - net.ipv6.conf.all.disable_ipv6=1
    restart: always

  # QBitTorrent - Download agent (Torrent & NZB)
  qbittorrent:
    #<<: *common
    image: ghcr.io/hotio/qbittorrent:latest
    container_name: qbittorrent
    network_mode: "service:gluetun"
    environment:
      - PUID=1000
      - PGID=1000
      - UMASK=002
      - WEBUI_PORTS=8085/tcp,8085/udp
    volumes:
      - /mnt/server/data/docker/arr-stack/qbittorrent:/config
      - /mnt/server/data/downloads:/data/downloads
    sysctls:
      - net.ipv4.conf.all.src_valid_mark=1
      - net.ipv6.conf.all.disable_ipv6=1
    depends_on:
      - gluetun
    restart: always

Working stuff removed

  lazylibrarian:
    <<: *common
    network_mode: "service:gluetun"
    image: lscr.io/linuxserver/lazylibrarian:latest
    container_name: lazylibrarian
    environment:
      - DOCKER_MODS=linuxserver/mods:universal-calibre|linuxserver/mods:lazylibrarian-ffmpeg #optional
      - PUID=1000
      - PGID=1000
      - UMASK=002
    volumes:
      - /mnt/medea/data/docker/arr-stack/lazylibrarian:/config
      - /mnt/medea/data:/data
    #  - /mnt/medea/data/complete/book:/books
    restart: always

more working stuff removed

secrets removed and ending in ...

networks:
  gluetun:
    enable_ipv6: false

### Container logs

```bash
## From LazyLibrarian web interface logs

Timestamp   Level   Message
2024-07-25 22:24:38,124 WARNING Invalid fmt_series: contains (
2024-07-25 19:07:09,459 DEBUG   Read config[LOGSPECIALDEBUG]=
2024-07-25 19:07:09,458 DEBUG   Read config[LOGDIR]=/config/log
2024-07-25 19:07:09,456 DEBUG   Set config[CONFIG_TAB_NUM]=3
2024-07-25 19:07:09,456 DEBUG   Set config[DOWNLOAD_DIR]=/downloads
2024-07-25 19:07:09,456 DEBUG   Set config[LOGDIR]=/config/log
2024-07-25 19:07:09,456 DEBUG   Set config[SERVER_ID]=384c1f2acfd74bf9a8c26e923644ef7c
2024-07-25 19:07:09,456 DEBUG   Set config[GIT_UPDATED]=1721934296
2024-07-25 19:07:09,456 DEBUG   Set config[INSTALL_TYPE]=source
2024-07-25 19:07:09,456 DEBUG   Set config[CURRENT_VERSION]=2ac29b36
2024-07-25 19:07:09,456 DEBUG   Set config[LATEST_VERSION]=2ac29b36
2024-07-25 19:07:09,456 DEBUG   Set config[AUDIOBOOK_DEST_FOLDER]=$Author/$Title
Showing 1 to 12 of 12 rows
github-actions[bot] commented 1 month ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

nyhil116 commented 1 month ago

I'm having this same issue. I had just downloaded LazyLibrarian to use and any change made to the config page causes this error to occur. The other pages seem to work find (although I didn't check it exhaustively) but the config page is broken after any change.

dsync89 commented 1 month ago

I concur this issue still present as of 20240728. Was gonna give it a try on my unRAID server but this happen. It's rare for linuxserver container image to fail like this. Their other image work like rock solid.

diogonr commented 1 month ago

Pointing to release c8ad32b8-ls68 works for now

dsbrown commented 1 month ago

I don't know if this helps; but, I did as recommended above and changed the release I was pointing at to c8ad32b8-ls68 and yes, that works. When looking through the logs I see: '2024-07-30 21:47:39,896 WARNING Unknown option GENERAL.DESTINATION_DIR in config'. I am not concerned, I am assume this is just an option that was added between the latest release and c8ad32b8-ls68; but, maybe that is the area of code that is erroring out the config in the latest release? Maybe not, I am just trying to give you as much telemetry as possible.

HikariNoKitsune commented 2 weeks ago

Similar issue for me. mine however tells me that it has attempted the maximum number of recursive actions and thus has failed.

Setting it to point to the c8ad32b8-ls68 build worked for me however, and 'some' of the settings that previously was attempted to be saved, seemed to have carried over thankfully. but i'm 'resaving' them just to be safe...