Closed SteveR1984 closed 4 years ago
Hmm, getting errors in (only) the Docker version of GHC now, including the demo site, value errors like: GreenSSLSocket does not have a public constructor. Instances are returned by SSLContext.wrap_socket().
think this has to do with eventlet, log output, when adding a WWW-LINK resource, or WFS3 resource.
Tried upgrading eventlet==0.25.2
but then get other errors.
hc_web | 2020-04-25 19:39:16,317 - healthcheck - WARNING - Cannot use <function urlopen at 0x7ff9522e3830> on https://map5.nl: GreenSSLSocket does not have a public constructor. Instances are returned by SSLContext.wrap_socket().
ghc_web | Traceback (most recent call last):
ghc_web | File "/GeoHealthCheck/GeoHealthCheck/healthcheck.py", line 175, in sniff_test_resource
ghc_web | ows = ows_handler(url)
ghc_web | File "/usr/local/lib/python3.7/urllib/request.py", line 222, in urlopen
ghc_web | return opener.open(url, data, timeout)
ghc_web | File "/usr/local/lib/python3.7/urllib/request.py", line 525, in open
ghc_web | response = self._open(req, data)
ghc_web | File "/usr/local/lib/python3.7/urllib/request.py", line 543, in _open
ghc_web | '_open', req)
ghc_web | File "/usr/local/lib/python3.7/urllib/request.py", line 503, in _call_chain
ghc_web | result = func(*args)
ghc_web | File "/usr/local/lib/python3.7/urllib/request.py", line 1360, in https_open
ghc_web | context=self._context, check_hostname=self._check_hostname)
ghc_web | File "/usr/local/lib/python3.7/urllib/request.py", line 1317, in do_open
ghc_web | encode_chunked=req.has_header('Transfer-encoding'))
ghc_web | File "/usr/local/lib/python3.7/http/client.py", line 1244, in request
ghc_web | self._send_request(method, url, body, headers, encode_chunked)
ghc_web | File "/usr/local/lib/python3.7/http/client.py", line 1290, in _send_request
ghc_web | self.endheaders(body, encode_chunked=encode_chunked)
ghc_web | File "/usr/local/lib/python3.7/http/client.py", line 1239, in endheaders
ghc_web | self._send_output(message_body, encode_chunked=encode_chunked)
ghc_web | File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output
ghc_web | self.send(msg)
ghc_web | File "/usr/local/lib/python3.7/http/client.py", line 966, in send
ghc_web | self.connect()
ghc_web | File "/usr/local/lib/python3.7/http/client.py", line 1414, in connect
ghc_web | server_hostname=server_hostname)
ghc_web | File "/venv/lib/python3.7/site-packages/eventlet/green/ssl.py", line 392, in wrap_socket
ghc_web | return GreenSSLSocket(sock, *a, _context=self, **kw)
ghc_web | File "/venv/lib/python3.7/site-packages/eventlet/green/ssl.py", line 64, in __init__
ghc_web | ca_certs, do_handshake_on_connect and six.PY2, *args, **kw)
ghc_web | File "/usr/local/lib/python3.7/ssl.py", line 808, in __init__
ghc_web | f"{self.__class__.__name__} does not have a public "
ghc_web | TypeError: GreenSSLSocket does not have a public constructor. Instances are returned by SSLContext.wrap_socket().
ghc_web | 2020-04-25 19:39:16,326 - healthcheck - ERROR - Getting metadata failed: Cannot get WWW:LINK service instance for https://map5.nl
ghc_web | Traceback (most recent call last):
ghc_web | File "/GeoHealthCheck/GeoHealthCheck/healthcheck.py", line 183, in sniff_test_resource
ghc_web | raise ValueError(message)
ghc_web | ValueError: Cannot get WWW:LINK service instance for https://map5.nl
And when accessing a WFS3 resource like https://demo.geohealthcheck.org/resource/165?lang=en :
2020-04-25 20:48:45,354 - factory - ERROR - cannot create class 'GeoHealthCheck.plugins.probe.wfs3.WFS3Drilldown'
2020-04-25 20:48:45,354 - factory - ERROR - cannot create object instance from class 'GeoHealthCheck.plugins.probe.wfs3.WFS3Drilldown' e=open: path should be string, bytes or os.PathLike, not _NormalAccessor
2020-04-25 20:48:45,355 - init - ERROR - Exception on /resource/304 [GET]
Traceback (most recent call last):
File "/venv/lib/python3.7/site-packages/jsonschema/__init__.py", line 31, in <module>
from importlib import metadata
ImportError: cannot import name 'metadata' from 'importlib' (/usr/local/lib/python3.7/importlib/__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/venv/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/venv/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/venv/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/venv/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/venv/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/venv/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/GeoHealthCheck/GeoHealthCheck/app.py", line 482, in get_resource_by_id
return render_template('resource.html', resource=response)
File "/venv/lib/python3.7/site-packages/flask/templating.py", line 140, in render_template
ctx.app,
File "/venv/lib/python3.7/site-packages/flask/templating.py", line 120, in _render
rv = template.render(context)
File "/venv/lib/python3.7/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/venv/lib/python3.7/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "/venv/lib/python3.7/site-packages/jinja2/_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "/GeoHealthCheck/GeoHealthCheck/templates/resource.html", line 1, in top-level template code
{% extends "layout.html" %}
File "/GeoHealthCheck/GeoHealthCheck/templates/layout.html", line 128, in top-level template code
{% block body %}
File "/GeoHealthCheck/GeoHealthCheck/templates/resource.html", line 96, in block "body"
- {{ probe_var.name }} <br/>
File "/venv/lib/python3.7/site-packages/jinja2/environment.py", line 471, in getattr
return getattr(obj, attribute)
File "/GeoHealthCheck/GeoHealthCheck/models.py", line 177, in name
return self.probe_instance.NAME
File "/GeoHealthCheck/GeoHealthCheck/models.py", line 173, in probe_instance
return Factory.create_obj(self.probe_class)
File "/GeoHealthCheck/GeoHealthCheck/factory.py", line 30, in create_obj
raise e
File "/GeoHealthCheck/GeoHealthCheck/factory.py", line 23, in create_obj
class_obj = Factory.create_class(class_string)
File "/GeoHealthCheck/GeoHealthCheck/factory.py", line 52, in create_class
raise e
File "/GeoHealthCheck/GeoHealthCheck/factory.py", line 49, in create_class
[class_name]), class_name)
File "/GeoHealthCheck/GeoHealthCheck/plugins/probe/wfs3.py", line 3, in <module>
from openapi_spec_validator import openapi_v3_spec_validator
File "/venv/lib/python3.7/site-packages/openapi_spec_validator/__init__.py", line 7, in <module>
from openapi_spec_validator.factories import JSONSpecValidatorFactory
File "/venv/lib/python3.7/site-packages/openapi_spec_validator/factories.py", line 2, in <module>
from jsonschema import validators
File "/venv/lib/python3.7/site-packages/jsonschema/__init__.py", line 33, in <module>
import importlib_metadata as metadata
File "/venv/lib/python3.7/site-packages/importlib_metadata/__init__.py", line 602, in <module>
__version__ = version(__name__)
File "/venv/lib/python3.7/site-packages/importlib_metadata/__init__.py", line 564, in version
return distribution(distribution_name).version
File "/venv/lib/python3.7/site-packages/importlib_metadata/__init__.py", line 264, in version
return self.metadata['Version']
File "/venv/lib/python3.7/site-packages/importlib_metadata/__init__.py", line 252, in metadata
self.read_text('METADATA')
File "/venv/lib/python3.7/site-packages/importlib_metadata/__init__.py", line 524, in read_text
return self._path.joinpath(filename).read_text(encoding='utf-8')
File "/usr/local/lib/python3.7/pathlib.py", line 1206, in read_text
with self.open(mode='r', encoding=encoding, errors=errors) as f:
File "/usr/local/lib/python3.7/pathlib.py", line 1193, in open
opener=self._opener)
File "/usr/local/lib/python3.7/pathlib.py", line 1046, in _opener
return self._accessor.open(self, flags, mode)
File "/venv/lib/python3.7/site-packages/eventlet/green/os.py", line 107, in open
# `staticmethod` for py < 3.7 but not 3.7. That means we get here with
TypeError: open: path should be string, bytes or os.PathLike, not _NormalAccessor
@SteveR1984 @borrob reverting from 20.0.4 back to 19.9.0, as to get master
Docker image and demo site working again. Kept the pinning for Werkzeug 0.16.1.
Problem was easy to reproduce locally:
docker build -t geopython/geohealthcheck .
cd docker/compose && docker-compose up
So, I am in favour of upgrading to gunicorn 20.0.4, but only error-free. I tried upgrading eventlet and greenlet as well, but that did not help. Many more folks have similar problems (just Search on above errors) . Could also be Python-version and OS (alpine) related. Some suggest using pyOpenSSL
lib.
update gunicorn to 20.0.4 there is a bug in gunicorn 19.0.9 causing the web server to not load the bootstrap.min.css completely. open Geohealthcheck in chrome or firefox on a windows machine and press ctrl + F5 to replicate the issue screenshot of issue: https://imgur.com/eUfxFcR info: https://github.com/benoitc/gunicorn/issues/615 bug fix: https://github.com/benoitc/gunicorn/releases