pannal / Kitana

A responsive Plex plugin web frontend
Other
496 stars 25 forks source link

Routing/endless redirect issue with kitana #53

Closed yeahpmmx closed 3 years ago

yeahpmmx commented 3 years ago

Hi there, I've been having some trouble acccesing Kitana from outside. The Plex server is installed in a remote machine. Just cloned this repository and after selecting the source from the list (nat or relay) it enters in a endless loop that when I stop the browser says.

Successfully connected to PlexServer Timeout on PlexServer Error on PlexServer (see log): HTTPConnectionPool(host='xxx.xxx.xxx.xxx', port=32400): Read timed out. (read timeout=15)

I was hoping if there be any workaround for this, because Subzero has been timeouting as well and not able to download any subs :/

Thanks!

pannal commented 3 years ago

If Sub-Zero times out on the server itself, there's something seriously wrong.

Is that server firewalled or something? Kitana just uses the normal Plex API on port 32400, which has to be open.

yeahpmmx commented 3 years ago

Somehow it got fixed :) Didn't do anything. Maybe a restart or an update. Thanks for everything 👍

pax0707 commented 3 years ago

My experience:

Server select after login: :32400 local HTTPS - 500 error :32400 remote HTTPS IP/NAT - works :8443 remote HTTPS Relay - 500 error

If you were logged in from before you'll instantly get 500.

500 Internal Server Error
The server encountered an unexpected condition which prevented it from fulfilling the request.

Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\site-packages\urllib3\connection.py", line 159, in _new_conn
    conn = connection.create_connection(
  File "C:\Program Files\Python38\lib\site-packages\urllib3\util\connection.py", line 61, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "C:\Program Files\Python38\lib\socket.py", line 918, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\site-packages\urllib3\connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "C:\Program Files\Python38\lib\site-packages\urllib3\connectionpool.py", line 381, in _make_request
    self._validate_conn(conn)
  File "C:\Program Files\Python38\lib\site-packages\urllib3\connectionpool.py", line 978, in _validate_conn
    conn.connect()
  File "C:\Program Files\Python38\lib\site-packages\urllib3\connection.py", line 309, in connect
    conn = self._new_conn()
  File "C:\Program Files\Python38\lib\site-packages\urllib3\connection.py", line 171, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x00000174C5F00F10>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "C:\Program Files\Python38\lib\site-packages\urllib3\connectionpool.py", line 726, in urlopen
    retries = retries.increment(
  File "C:\Program Files\Python38\lib\site-packages\urllib3\util\retry.py", line 439, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='***.plex.direct', port=32400): Max retries exceeded with url: /servers (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x00000174C5F00F10>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\site-packages\cherrypy\_cprequest.py", line 638, in respond
    self._do_respond(path_info)
  File "C:\Program Files\Python38\lib\site-packages\cherrypy\_cprequest.py", line 697, in _do_respond
    response.body = self.handler()
  File "C:\Program Files\Python38\lib\site-packages\cherrypy\lib\encoding.py", line 219, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "C:\Program Files\Python38\lib\site-packages\cherrypy\_cpdispatch.py", line 54, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "C:\PLEX\Kitana\kitana.py", line 493, in servers
    servers = self.discover_pms(server_name=server_name, server_addr=server_addr)
  File "C:\PLEX\Kitana\kitana.py", line 457, in discover_pms
    self.session.get(self.server_addr + "servers", headers=self.full_headers, **self.req_defaults)
  File "C:\Program Files\Python38\lib\site-packages\requests\sessions.py", line 543, in get
    return self.request('GET', url, **kwargs)
  File "C:\Program Files\Python38\lib\site-packages\requests\sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Program Files\Python38\lib\site-packages\requests\sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "C:\Program Files\Python38\lib\site-packages\requests\adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='***.plex.direct', port=32400): Max retries exceeded with url: /servers (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x00000174C5F00F10>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
pannal commented 3 years ago

Do you have a log from when you tried the local connection?

pax0707 commented 3 years ago

I'll generate it when I get back home.

What exact log do you need? Plex or Sub-Zero?

pannal commented 3 years ago

Plex and Kitana.

pax0707 commented 3 years ago

:32400 local HTTPS - 500 :32400 remote HTTPS IP/NAT - working *:8443 remote HTTPS Relay - working

Both are running on the same PC.

Plex:

Mar 10, 2021 03:06:29.449 [7472] INFO - Plex Media Server v1.22.0.4163-d8c4875dd - Microsoft PC x64 - build: windows-x86 windows - GMT 01:00
Mar 10, 2021 03:06:29.449 [7472] INFO - Windows version: 10.0 (Build 19042), language en-US
Mar 10, 2021 03:06:29.449 [7472] INFO - 12 3194 MHz processor(s): Architecture=0, Level=23, Revision=2050 Processor Identifier=AMD64 Family 23 Model 8 Stepping 2, AuthenticAMD
Mar 10, 2021 03:06:29.836 [5300] INFO - [CERT/OCSP] Successfully retrieved response from cache.
Mar 10, 2021 03:06:32.206 [12192] WARN - MyPlex: attempted a reachability check but we're not yet online.
Mar 10, 2021 03:06:32.486 [12192] INFO - AutoUpdate: no updates available
Mar 10, 2021 03:06:32.929 [1772] ERROR - getaddrinfo(xxxx.plex.direct) failed: 11001
Mar 10, 2021 03:06:33.655 [12364] WARN - Sync: sync list 936287 belonging to user 1 (xxxxx) has died of old age, ignoring
Mar 10, 2021 03:06:33.655 [12364] WARN - Sync: sync list 36528582 belonging to user 4082648 (xxxx) has died of old age, ignoring
Mar 10, 2021 03:06:33.666 [12364] INFO - Sync: downloaded 2 sync list(s) with 35 sync items(s): 0 new, 0 updated, 0 deleted
Mar 10, 2021 03:06:33.860 [7612] WARN - MyPlex: attempted a reachability check but we're not yet online.
Mar 10, 2021 03:06:33.954 [10704] ERROR - LPE: unknown item 568676.
Mar 10, 2021 03:06:33.954 [10704] ERROR - Sync: failed to generate query for path library://fb503c57-3a5d-46dd-bb4e-e78c825febff/directory/%2Flibrary%2Fmetadata%2F568676%2Fchildren in sync item 44851501
Mar 10, 2021 03:06:33.954 [10704] ERROR - Sync: empty sync set, unable to update status for sync list 35404958, sync item 44851501
Mar 10, 2021 03:06:33.955 [10704] ERROR - LPE: unknown item 520384.
Mar 10, 2021 03:06:33.955 [10704] ERROR - Sync: failed to generate query for path library://5bfb5c85-ec6f-47e2-935a-dc43dde8e6a4/item/%2Flibrary%2Fmetadata%2F520384 in sync item 44856008
Mar 10, 2021 03:06:33.955 [10704] ERROR - Sync: empty sync set, unable to update status for sync list 35404958, sync item 44856008
Mar 10, 2021 03:06:33.956 [10704] ERROR - LPE: unknown item 600777.
Mar 10, 2021 03:06:33.956 [10704] ERROR - Sync: failed to generate query for path library://d2d79165-9929-4c00-94c1-8216b6d4bf9f/item/%2Flibrary%2Fmetadata%2F600777 in sync item 45900771
Mar 10, 2021 03:06:33.956 [10704] ERROR - Sync: empty sync set, unable to update status for sync list 42928927, sync item 45900771
Mar 10, 2021 03:06:33.957 [10704] ERROR - LPE: unknown item 453321.
Mar 10, 2021 03:06:33.957 [10704] ERROR - Sync: failed to generate query for path library://d2d79165-9929-4c00-94c1-8216b6d4bf9f/item/%2Flibrary%2Fmetadata%2F453321 in sync item 45900773
Mar 10, 2021 03:06:33.957 [10704] ERROR - Sync: empty sync set, unable to update status for sync list 42928927, sync item 45900773
Mar 10, 2021 03:06:33.957 [10704] ERROR - LPE: unknown item 490890.
Mar 10, 2021 03:06:33.957 [10704] ERROR - Sync: failed to generate query for path library://d2d79165-9929-4c00-94c1-8216b6d4bf9f/item/%2Flibrary%2Fmetadata%2F490890 in sync item 45900775
Mar 10, 2021 03:06:33.957 [10704] ERROR - Sync: empty sync set, unable to update status for sync list 42928927, sync item 45900775
Mar 10, 2021 03:06:33.958 [10704] ERROR - LPE: unknown item 490891.
Mar 10, 2021 03:06:33.958 [10704] ERROR - Sync: failed to generate query for path library://d2d79165-9929-4c00-94c1-8216b6d4bf9f/item/%2Flibrary%2Fmetadata%2F490891 in sync item 45900776
Mar 10, 2021 03:06:33.958 [10704] ERROR - Sync: empty sync set, unable to update status for sync list 42928927, sync item 45900776
Mar 10, 2021 03:06:34.156 [14300] INFO - AutoUpdate: no updates available
Mar 10, 2021 03:06:34.844 [1348] ERROR - getaddrinfo(xxxx.plex.direct) failed: 11001
Mar 10, 2021 03:06:34.914 [1348] WARN - MyPlex: attempted a reachability check but we're not yet mapped.
Mar 10, 2021 03:06:35.235 [14972] WARN - NAT: PMP, got an error: NATPMP_ERR_RECVFROM.
Mar 10, 2021 03:06:40.142 [13876] INFO - Refreshing paths watched by LibraryUpdateManager
Mar 10, 2021 03:06:54.148 [6888] ERROR - Error issuing curl_easy_perform(handle): 6
Mar 10, 2021 03:06:54.400 [15108] ERROR - Unknown metadata type: 
Mar 10, 2021 03:06:59.250 [10296] ERROR - Error issuing curl_easy_perform(handle): 28
Mar 10, 2021 03:06:59.330 [4940] ERROR - Unknown metadata type: 
Mar 10, 2021 03:07:12.333 [11680] INFO - [PlexRelay] Allocated port 1211 for remote forward to 127.0.0.1:32401
Mar 10, 2021 03:08:29.470 [2556] ERROR - LPE: unknown item 600777.
Mar 10, 2021 03:08:29.470 [2556] ERROR - Sync: failed to generate query for path library://d2d79165-9929-4c00-94c1-8216b6d4bf9f/item/%2Flibrary%2Fmetadata%2F600777 in sync item 45900771
Mar 10, 2021 03:08:29.470 [2556] ERROR - Sync: skipping items for sync list 42928927, sync item 45900771: unable to generate sync set query
Mar 10, 2021 03:08:29.470 [2556] ERROR - LPE: unknown item 453321.
Mar 10, 2021 03:08:29.470 [2556] ERROR - Sync: failed to generate query for path library://d2d79165-9929-4c00-94c1-8216b6d4bf9f/item/%2Flibrary%2Fmetadata%2F453321 in sync item 45900773
Mar 10, 2021 03:08:29.470 [2556] ERROR - Sync: skipping items for sync list 42928927, sync item 45900773: unable to generate sync set query
Mar 10, 2021 03:08:29.470 [2556] ERROR - LPE: unknown item 490890.
Mar 10, 2021 03:08:29.470 [2556] ERROR - Sync: failed to generate query for path library://d2d79165-9929-4c00-94c1-8216b6d4bf9f/item/%2Flibrary%2Fmetadata%2F490890 in sync item 45900775
Mar 10, 2021 03:08:29.470 [2556] ERROR - Sync: skipping items for sync list 42928927, sync item 45900775: unable to generate sync set query
Mar 10, 2021 03:08:29.471 [2556] ERROR - LPE: unknown item 490891.
Mar 10, 2021 03:08:29.471 [2556] ERROR - Sync: failed to generate query for path library://d2d79165-9929-4c00-94c1-8216b6d4bf9f/item/%2Flibrary%2Fmetadata%2F490891 in sync item 45900776
Mar 10, 2021 03:08:29.471 [2556] ERROR - Sync: skipping items for sync list 42928927, sync item 45900776: unable to generate sync set query
Mar 10, 2021 03:08:29.908 [2556] ERROR - LPE: unknown item 568676.
Mar 10, 2021 03:08:29.908 [2556] ERROR - Sync: failed to generate query for path library://fb503c57-3a5d-46dd-bb4e-e78c825febff/directory/%2Flibrary%2Fmetadata%2F568676%2Fchildren in sync item 44851501
Mar 10, 2021 03:08:29.908 [2556] ERROR - Sync: skipping items for sync list 35404958, sync item 44851501: unable to generate sync set query
Mar 10, 2021 03:08:29.908 [2556] ERROR - LPE: unknown item 520384.
Mar 10, 2021 03:08:29.908 [2556] ERROR - Sync: failed to generate query for path library://5bfb5c85-ec6f-47e2-935a-dc43dde8e6a4/item/%2Flibrary%2Fmetadata%2F520384 in sync item 44856008
Mar 10, 2021 03:08:29.908 [2556] ERROR - Sync: skipping items for sync list 35404958, sync item 44856008: unable to generate sync set query

Kitana v0.4.2 (standalone):

500 Internal Server Error
The server encountered an unexpected condition which prevented it from fulfilling the request.

Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\site-packages\urllib3\connection.py", line 159, in _new_conn
    conn = connection.create_connection(
  File "C:\Program Files\Python38\lib\site-packages\urllib3\util\connection.py", line 61, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "C:\Program Files\Python38\lib\socket.py", line 918, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\site-packages\urllib3\connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "C:\Program Files\Python38\lib\site-packages\urllib3\connectionpool.py", line 381, in _make_request
    self._validate_conn(conn)
  File "C:\Program Files\Python38\lib\site-packages\urllib3\connectionpool.py", line 978, in _validate_conn
    conn.connect()
  File "C:\Program Files\Python38\lib\site-packages\urllib3\connection.py", line 309, in connect
    conn = self._new_conn()
  File "C:\Program Files\Python38\lib\site-packages\urllib3\connection.py", line 171, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x000001D46ADB7AF0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "C:\Program Files\Python38\lib\site-packages\urllib3\connectionpool.py", line 726, in urlopen
    retries = retries.increment(
  File "C:\Program Files\Python38\lib\site-packages\urllib3\util\retry.py", line 439, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='xxxx.plex.direct', port=32400): Max retries exceeded with url: /servers (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001D46ADB7AF0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\site-packages\cherrypy\_cprequest.py", line 638, in respond
    self._do_respond(path_info)
  File "C:\Program Files\Python38\lib\site-packages\cherrypy\_cprequest.py", line 697, in _do_respond
    response.body = self.handler()
  File "C:\Program Files\Python38\lib\site-packages\cherrypy\lib\encoding.py", line 219, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "C:\Program Files\Python38\lib\site-packages\cherrypy\_cpdispatch.py", line 54, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "C:\PLEX\Kitana\kitana.py", line 510, in servers
    servers = self.discover_pms(server_name=server_name, server_addr=server_addr)
  File "C:\PLEX\Kitana\kitana.py", line 474, in discover_pms
    self.session.get(self.server_addr + "servers", headers=self.full_headers, **self.req_defaults)
  File "C:\Program Files\Python38\lib\site-packages\requests\sessions.py", line 543, in get
    return self.request('GET', url, **kwargs)
  File "C:\Program Files\Python38\lib\site-packages\requests\sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Program Files\Python38\lib\site-packages\requests\sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "C:\Program Files\Python38\lib\site-packages\requests\adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='xxxx.plex.direct', port=32400): Max retries exceeded with url: /servers (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001D46ADB7AF0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
Powered by CherryPy 18.6.0
pannal commented 3 years ago

Yeah it's interesting that Plex sets the "local" one via the plex.direct domain. That one doesn't seem to route well in your instance.

Can you ping that host/connect to it from where Kitana runs?

pax0707 commented 3 years ago

They both run on the same PC. Tried just in case, I can ping it LAN IP, localhost, etc.

pannal commented 3 years ago

No, can you ping the host that Kitana fails establishing a connection with? xxxxxx.plex.direct

pax0707 commented 3 years ago

Ping request could not find host.

Does it even suppose to respond to ICMP?

pannal commented 3 years ago

I guess so. If not, you can always try to reach port 32400. But for me my plex.direct pings (resolves to my external IP):

ping vv-ee-zz-yy.xxxxxxxxxxxxxxx.plex.direct

Ping wird ausgeführt für vv-ee-zz-yy.xxxxxxxxxxxxxxx.plex.direc [vv-ee-zz-yy] mit 32 Bytes Daten:
Antwort von vv-ee-zz-yy: Bytes=32 Zeit<1ms TTL=64
Antwort von vv-ee-zz-yy: Bytes=32 Zeit<1ms TTL=64
Antwort von vv-ee-zz-yy: Bytes=32 Zeit<1ms TTL=64

Did you allow DNS rebind for plex.direct on your router?

pax0707 commented 3 years ago

Router settings look fine to me. TBH - as long as one of the ways works it's enough for me. ;- ) =