niemands / StashPlugins

A collection of python plugins for stash
GNU Affero General Public License v3.0
62 stars 17 forks source link

Crash: "No connection could be made because the target machine actively refused it" #13

Closed jeremymeyers closed 3 years ago

jeremymeyers commented 3 years ago

Getting this error when attempting to tag.

Details:

ERRO[2021-06-11 20:27:52] [Plugin] Traceback (most recent call last): ERRO[2021-06-11 20:27:52] [Plugin] File "C:\Users\softl\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 169, in _new_conn ERRO[2021-06-11 20:27:52] [Plugin] conn = connection.create_connection( ERRO[2021-06-11 20:27:52] [Plugin] File "C:\Users\softl\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\connection.py", line 96, in create_connection ERRO[2021-06-11 20:27:52] [Plugin] raise err ERRO[2021-06-11 20:27:52] [Plugin] File "C:\Users\softl\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\connection.py", line 86, in create_connection ERRO[2021-06-11 20:27:52] [Plugin] sock.connect(sa) ERRO[2021-06-11 20:27:52] [Plugin] ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

ERRO[2021-06-11 20:27:52] [Plugin] During handling of the above exception, another exception occurred: ERRO[2021-06-11 20:27:52] [Plugin] Traceback (most recent call last): ERRO[2021-06-11 20:27:52] [Plugin] File "C:\Users\softl\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen ERRO[2021-06-11 20:27:52] [Plugin] httplib_response = self._make_request( ERRO[2021-06-11 20:27:52] [Plugin] File "C:\Users\softl\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 394, in _make_request ERRO[2021-06-11 20:27:52] [Plugin] conn.request(method, url, **httplib_request_kw) ERRO[2021-06-11 20:27:52] [Plugin] File "C:\Users\softl\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 234, in request ERRO[2021-06-11 20:27:52] [Plugin] super(HTTPConnection, self).request(method, url, body=body, headers=headers) ERRO[2021-06-11 20:27:52] [Plugin] File "C:\Users\softl\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1253, in request ERRO[2021-06-11 20:27:52] [Plugin] self._send_request(method, url, body, headers, encode_chunked) ERRO[2021-06-11 20:27:52] [Plugin] File "C:\Users\softl\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1299, in _send_request ERRO[2021-06-11 20:27:52] [Plugin] self.endheaders(body, encode_chunked=encode_chunked) ERRO[2021-06-11 20:27:52] [Plugin] File "C:\Users\softl\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1248, in endheaders ERRO[2021-06-11 20:27:52] [Plugin] self._send_output(message_body, encode_chunked=encode_chunked) ERRO[2021-06-11 20:27:52] [Plugin] File "C:\Users\softl\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1008, in _send_output ERRO[2021-06-11 20:27:52] [Plugin] self.send(msg) ERRO[2021-06-11 20:27:52] [Plugin] File "C:\Users\softl\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 948, in send ERRO[2021-06-11 20:27:52] [Plugin] self.connect() ERRO[2021-06-11 20:27:52] [Plugin] File "C:\Users\softl\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 200, in connect ERRO[2021-06-11 20:27:52] [Plugin] conn = self._new_conn() ERRO[2021-06-11 20:27:52] [Plugin] File "C:\Users\softl\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 181, in _new_conn ERRO[2021-06-11 20:27:52] [Plugin] raise NewConnectionError( ERRO[2021-06-11 20:27:52] [Plugin] urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x000001CE900CFAF0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it

ERRO[2021-06-11 20:27:52] [Plugin] During handling of the above exception, another exception occurred: ERRO[2021-06-11 20:27:52] [Plugin] Traceback (most recent call last): ERRO[2021-06-11 20:27:52] [Plugin] File "C:\Users\softl\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 439, in send ERRO[2021-06-11 20:27:52] [Plugin] resp = conn.urlopen( ERRO[2021-06-11 20:27:52] [Plugin] File "C:\Users\softl\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen ERRO[2021-06-11 20:27:52] [Plugin] retries = retries.increment( ERRO[2021-06-11 20:27:52] [Plugin] File "C:\Users\softl\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\retry.py", line 574, in increment ERRO[2021-06-11 20:27:52] [Plugin] raise MaxRetryError(_pool, url, error or ResponseError(cause)) ERRO[2021-06-11 20:27:52] [Plugin] urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=6969): Max retries exceeded with url: /graphql (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001CE900CFAF0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it')) ERRO[2021-06-11 20:27:52] [Plugin] During handling of the above exception, another exception occurred: ERRO[2021-06-11 20:27:52] [Plugin] Traceback (most recent call last): ERRO[2021-06-11 20:27:52] [Plugin] File "m:\stash\plugins\py_plugins\bulk_url_scraper.py", line 212, in ERRO[2021-06-11 20:27:52] [Plugin] main() ERRO[2021-06-11 20:27:52] [Plugin] File "m:\stash\plugins\py_plugins\bulk_url_scraper.py", line 18, in main ERRO[2021-06-11 20:27:52] [Plugin] run(json_input, output) ERRO[2021-06-11 20:27:52] [Plugin] File "m:\stash\plugins\py_plugins\bulk_url_scraper.py", line 47, in run ERRO[2021-06-11 20:27:52] [Plugin] add_tag(client) ERRO[2021-06-11 20:27:52] [Plugin] File "m:\stash\plugins\py_plugins\bulk_url_scraper.py", line 192, in add_tag ERRO[2021-06-11 20:27:52] [Plugin] tag_id = client.findTagIdWithName(control_tag) ERRO[2021-06-11 20:27:52] [Plugin] File "m:\stash\plugins\py_plugins\stash_interface.py", line 95, in findTagIdWithName ERRO[2021-06-11 20:27:52] [Plugin] result = self.callGraphQL(query) ERRO[2021-06-11 20:27:52] [Plugin] File "m:\stash\plugins\py_plugins\stash_interface.py", line 39, in callGraphQL ERRO[2021-06-11 20:27:52] [Plugin] response = requests.post(self.url, json=json, headers=self.headers, cookies=self.cookies) ERRO[2021-06-11 20:27:52] [Plugin] File "C:\Users\softl\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 119, in post ERRO[2021-06-11 20:27:52] [Plugin] return request('post', url, data=data, json=json, kwargs) ERRO[2021-06-11 20:27:52] [Plugin] File "C:\Users\softl\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 61, in request ERRO[2021-06-11 20:27:52] [Plugin] return session.request(method=method, url=url, kwargs) ERRO[2021-06-11 20:27:52] [Plugin] File "C:\Users\softl\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 542, in request ERRO[2021-06-11 20:27:52] [Plugin] resp = self.send(prep, send_kwargs) ERRO[2021-06-11 20:27:52] [Plugin] File "C:\Users\softl\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 655, in send ERRO[2021-06-11 20:27:52] [Plugin] r = adapter.send(request, kwargs) ERRO[2021-06-11 20:27:52] [Plugin] File "C:\Users\softl\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 516, in send ERRO[2021-06-11 20:27:52] [Plugin] raise ConnectionError(e, request=request) ERRO[2021-06-11 20:27:52] [Plugin] requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=6969): Max retries exceeded with url: /graphql (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001CE900CFAF0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it')) ERRO[2021-06-11 20:27:52] Plugin returned error: exit status 1

niemands commented 3 years ago

I could not reproduce this error, even with the non default port. Can you access http://localhost:6969/graphql in your browser?

jeremymeyers commented 3 years ago

@niemands i think the problem is that stash isn't configured to run as localhost, i changed it to run as my computers IP so that i can access it from elsewhere. So i guess it shouldn't assume "localhost" in the url?

niemands commented 3 years ago

I don't know what your setup is, but most of the times you can leave the host config at 0.0.0.0 and still receive connections from other IPs.

jeremymeyers commented 3 years ago

not if you want to be able to connect from outside the subnet? at least that is not my experience and not what the docs/ @withoutpants says. (unless it's changed in versions since 0.5)

niemands commented 3 years ago

To be honest, I'm not that good with networking, but the testing I have done checks out with the response I got on Discord, that the host address only specifies the interface. So for the original issue: There is currently an open issue https://github.com/stashapp/stash/issues/1155 to solve this problem. But for the time being you can change the localhost in the stash_interface.py to your local IP https://github.com/niemands/StashPlugins/blob/12285ce0539783e434163fa2589d7a1efd527a21/py_plugins/stash_interface.py#L28

jeremymeyers commented 3 years ago

Ahh i was looking for where that might be. I bet that'll fix it. Maybe include in docs?