500 Internal Server Error
qubiq1337 opened this issue · 3 comments
qubiq1337 commented
Hi.
I build and run project from docker-image, however, when i am trying to fetch proxy list by API i get 500 Internal Server Error.
I got something like this in console:
ERROR ~ [proxy_py/server] ~ 2020-02-03 09:58:48,802 ~ log():L57 - Your reverse proxy doesn't present user's IP.
I am tryed different network connections.
How to fix that?
qubiq1337 commented
So, this error occurs only if I try to get a large number of proxies(>600).
curl -X POST http://127.0.0.1:55555/api/v1/ -H "Content-Type: application/json" --data '{"model": "proxy", "method": "get", "limit": 1}'
{"status":"OK" ...}
curl -X POST http://127.0.0.1:55555/api/v1/ -H "Content-Type: application/json" --data '{"model": "proxy", "method": "get", "limit": 600}'
Server error
Howewer its around 32000 proxyes avaliable.
curl -X POST http://127.0.0.1:55555/api/v1/ -H "Content-Type: application/json" --data '{"model": "proxy", "method": "count"}'
{"status": "ok", "count": 32301, "status_code": 200}
There is messages like this in log
core_1 | ERROR ~ [proxy_py/server] ~ 2020-02-04 09:24:46,864 ~ log():L60 - AddressNotFoundError('The address 162.159.251.132 is not in the database.')
core_1 | Traceback (most recent call last):
core_1 | File "/proxy_py/server/api_v1/requests_to_models/request_executor.py", line 13, in execute
core_1 | return await self._fetch(request)
core_1 | File "/proxy_py/server/api_v1/requests_to_models/request_executor.py", line 53, in _fetch
core_1 | obj[field_name] = getattr(item, field_name)
core_1 | File "/proxy_py/models.py", line 81, in location
core_1 | response = location_database_reader.city(self.domain)
core_1 | File "/proxy_py/env/lib/python3.7/site-packages/geoip2/database.py", line 114, in city
core_1 | return self._model_for(geoip2.models.City, 'City', ip_address)
core_1 | File "/proxy_py/env/lib/python3.7/site-packages/geoip2/database.py", line 195, in _model_for
core_1 | record = self._get(types, ip_address)
core_1 | File "/proxy_py/env/lib/python3.7/site-packages/geoip2/database.py", line 191, in _get
core_1 | "The address %s is not in the database." % ip_address)
core_1 | geoip2.errors.AddressNotFoundError: The address 162.159.251.132 is not in the database.
core_1 |
core_1 | During handling of the above exception, another exception occurred:
core_1 |
core_1 | Traceback (most recent call last):
core_1 | File "/proxy_py/server/api_v1/api_request_handler.py", line 22, in handle
core_1 | response.update(await self.request_executor.execute(req_dict))
core_1 | File "/proxy_py/server/api_v1/requests_to_models/request_executor.py", line 20, in execute
core_1 | raise ExecutionError(repr(ex))
core_1 | server.api_v1.requests_to_models.request_executor.ExecutionError: AddressNotFoundError('The address 162.159.251.132 is not in the database.')
qubiq1337 commented
proxy_py=# select count(*) from proxies;
count
-------
39001
(1 row)
DevAlone commented
The error is saying that, for some reason, there is no such IP in geo database. As a workaround, you can try to request specific fields like this:
curl -v -X POST https://localhost:55555/api/v1/ --data '{"method": "get", "model": "proxy", "limit": 1, "fields": "address,response_time"}'
without location
field. Probably it will do the trick.
Thanks for the issue, I will fix it at some point.