RemiRigal / Plex-Auto-Languages

Automated language selection for Plex TV Shows !
MIT License
428 stars 16 forks source link

Server access is removed when running PAL docker #18

Closed Metuant closed 2 years ago

Metuant commented 2 years ago

When running PAL docker I lose the ability to "see" my Plex server via app.plex.tv and local connection. Stopping the container allows access to the server. Config.yaml (redacted token info) and docker-compose config are below.

plexautolanguages:
  # Update language for the entire show or only for the current season
  # Accepted values:
  #   - show (default)
  #   - season
  update_level: "show"

  # Update all episodes of the show/season or only the next ones
  # Accepted values:
  #   - all (default)
  #   - next
  update_strategy: "all"

  # Whether or not playing a file should trigger a language update, defaults to 'true'
  trigger_on_play: true

  # Whether or not navigating the Plex library should trigger a language update, defaults to 'false'
  # Set this to 'true' only if you want to perform changes whenever the default track of an episode is updated, even when the episode is not played.
  # Setting this parameter to 'true' can result in higher resource usage.
  trigger_on_activity: false

  # Plex configuration
  plex:
    # A valid Plex URL (required)
    url: "http://plex:32400"
    # A valid Plex Token (required)
    token: "XXXXXXX"

  scheduler:
    # Whether of not to enable the scheduler, defaults to 'true'
    # The scheduler will perform a deeper analysis of all recently played TV Shows
    enable: false
    # The time at which the scheduler start its task with the format 'HH:MM', defaults to '02:00'
    schedule_time: "07:00"

   notifications:
    # Whether of not to enable the notifications through Apprise, defaults to 'false'
    # A notification is sent whenever a language change is performed
    enable: false
    # An array of Apprise configurations, see Apprise docs for more information: https://github.com/caronc/apprise
    apprise_configs:
      - "XXXXXX"

Compose config

### PAL###
  PAL:
    image: remirigal/plex-auto-languages:latest
    container_name: PAL
    environment:
      - TZ=${TZ}
    volumes:
      - ${APPDATA_ROOT}/PAL/config.yaml:/config/config.yaml
    restart: unless-stopped
RemiRigal commented 2 years ago

Do you have any relevant output from the container ?

Metuant commented 2 years ago

Nothing significant from the PAL container. The Plex container, however, throws a ton of the following:

Scan :: files: []
Scan :: mediaList: []
Scan :: subdirs: ['_insert random media directory here_']

Before finally crashing and producing a .dmp for the event. Does this help? Is there additional information I can provide to help troubleshoot?

RemiRigal commented 2 years ago

I don't see how the access to Plex can be compromised by PlexAutoLanguages, it only creates a WebSocket connection with the instance and uses the exposed API. Maybe you are using an outdated version of Plex ?

Metuant commented 2 years ago

I'm also a little confused by the behavior. Running 1.26.0.5715 - things run fine for about 3 - 5 minutes. I'll notice via an app like PlexDash that the server is wiped out (similar on plex web, local access). Already running streams are not interrupted.

Stopping the PAL container and restarting Plex restore connectivity.

I'll continue to explore other variables and update on what I find. If you have any leads as to where to continue my own troubleshooting i'm open to them.

RemiRigal commented 2 years ago

Some leads that come to my mind in no particular order:

Metuant commented 2 years ago

Do you have Plex running behind a reverse proxy ?

Is Plex running with Docker ? If so, are both containers in the same Docker network ?

Your Plex URL uses a hostname, does the issue still happen if you put an IP instead ?

This issue persists whether utilizing docker or running outside of docker.

Metuant commented 2 years ago

@RemiRigal - have you had a moment to look further at this?

RemiRigal commented 2 years ago

Yes I have tried to reproduce the issue in several ways. I've created multiple VMs with various docker/docker-compose and Traefik versions but I'm unable to reproduce the issue.

The HTTP requests from PAL are probably not causing the issue so my guess is that your configuration is messed up by the WebSocket connection. Since WebSockets are supported by default by Traefik and bypassing Traefik (by using the Plex machine IP) produces the same behavior, I'm out of idea...

Can you try with the latest version of PAL with the debug mode enabled ? You just have to add debug: true in your configuration file, see the project's README for example.

Can you give me the following information as well:

Metuant commented 2 years ago

Running latest version of PAL with debug enabled shows no errors. but every minute or so there is a stopping of the cache proces and then it kicks off again: [INFO] Scanning all episodes from the Plex library, this action should only take a few seconds but can take several minutes for larger libraries [DEBUG] [Cache] Refreshing library cache [INFO] Received SIGINT or SIGTERM, stopping gracefully

Your host OS and Kernel version

Metuant commented 2 years ago

@RemiRigal using a client-side token seemed to have resolved this particular issue.

EDIT: For others who have problems - DO NOT use the token from preferences.xml - use token generated https://github.com/Cloudbox/Cloudbox/blob/master/roles/scripts/files/plex_token.sh