dsys / match

:crystal_ball: Scalable reverse image search built on Kubernetes and Elasticsearch
Other
1.24k stars 150 forks source link

urllib3.connection.HTTPConnection object at 0x7fa5c0f1eac8 #25

Open Radzhab opened 6 years ago

Radzhab commented 6 years ago

When i post image its raise error

{"status": "fail", "error": ["ConnectionError(<urllib3.connection.HTTPConnection object at 0x7fa5c0f1eac8>: Failed to establish a new connection: [Errno 111] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7fa5c0f1eac8>: Failed to establish a new connection: [Errno 111] Connection refused)"], "method": "", "result": []}


multipart
------------------bRr6A3mUNSNYh2ZE
Content-Disposition: form-data; name="filepath"

10.jpg
------------------bRr6A3mUNSNYh2ZE
Content-Disposition: form-data; name="image"; filename="10.jpg"
Content-Type: image/jpeg

яШяа
D:\phash>docker attach c6359f905dc6
[2018-02-20 13:45:13 +0000] [1] [INFO] Starting gunicorn 19.7.1
[2018-02-20 13:45:13 +0000] [1] [INFO] Listening at: http://0.0.0.0:8888 (1)
[2018-02-20 13:45:13 +0000] [1] [INFO] Using worker: sync
[2018-02-20 13:45:13 +0000] [20] [INFO] Booting worker with pid: 20                                                     [2018-02-20 13:45:13 +0000] [21] [INFO] Booting worker with pid: 21
[2018-02-20 13:45:13 +0000] [22] [INFO] Booting worker with pid: 22
[2018-02-20 13:45:13 +0000] [23] [INFO] Booting worker with pid: 23
GET http://elasticsearch:9200/images/_search?_source=_id&q=path%3A%22123123.jpg%22 [status:N/A request:6.329s]
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 387, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from                                                                                  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 383, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/usr/local/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.6/http/client.py", line 266, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/elasticsearch/connection/http_urllib3.py", line 94, in perform_request
    response = self.pool.urlopen(method, url, body, retries=False, headers=self.headers, **kw)
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py", line 333, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.6/site-packages/urllib3/packages/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 387, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 383, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/usr/local/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.6/http/client.py", line 266, in _read_status                                                 raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))
POST http://elasticsearch:9200/images/images?refresh=false [status:N/A request:1.631s]
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 141, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py", line 83, in create_connection
    raise err
  File "/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py", line 73, in create_connection                   sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:
briannovillo commented 4 years ago

This error occurs because elasticsearch container is throwing a virtual memory error.

You must run this command for increment max memory usage, according https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html: sysctl -w vm.max_map_count=262144

And then start docker containers manually (containers name could vary): docker start match_elasticsearch -i docker start match_match -i I'm going to create a Pull Request setting this config on docker compose file for fix the error. But this is the temporary fix until they approve it.

briannovillo commented 4 years ago

This error occurs because elasticsearch container is throwing a virtual memory error.

You must run this command for increment max memory usage, according https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html: sysctl -w vm.max_map_count=262144

And then start docker containers manually (containers name could vary): docker start match_elasticsearch -i docker start match_match -i I'm going to create a Pull Request setting this config on docker compose file for fix the error. But this is the temporary fix until they approve it.

This is the PR #40