Two days ago my django app which runs on an Ubuntu 18.04.2 LTS server with 
apache and mod_wsgi in an venv with Python 3.6 throws an exception after 
https login - as it seems - after a package upgrade.
To my understanding libssl/openssl is causing the error. The error message 
below states that openssl_1_1_1 is not found. Though it seems to be 
installed.

Could you guys give me a pointer? Please let me know if I need to provide 
additional information.

Thanks and cheers!



Two days ago following packages where upgraded:
=====================================
    libelf1:amd64 0.170-0.4 => 0.170-0.4ubuntu0.1
    libglib2.0-0:amd64 2.56.4-0ubuntu0.18.04.2 => 2.56.4-0ubuntu0.18.04.3
    libglib2.0-data:all 2.56.4-0ubuntu0.18.04.2 => 2.56.4-0ubuntu0.18.04.3
    libnss-systemd:amd64 237-3ubuntu10.21 => 237-3ubuntu10.22
    libpam-systemd:amd64 237-3ubuntu10.21 => 237-3ubuntu10.22
    libpython3.6-minimal:amd64 3.6.7-1~18.04 => 3.6.8-1~18.04.1
    libpython3.6-stdlib:amd64 3.6.7-1~18.04 => 3.6.8-1~18.04.1
    libpython3.6:amd64 3.6.7-1~18.04 => 3.6.8-1~18.04.1
    libssl1.1:amd64 1.1.0g-2ubuntu4.3 => 1.1.1-1ubuntu2.1~18.04.1
    libsystemd0:amd64 237-3ubuntu10.21 => 237-3ubuntu10.22
    libudev1:amd64 237-3ubuntu10.21 => 237-3ubuntu10.22
    openssl:amd64 1.1.0g-2ubuntu4.3 => 1.1.1-1ubuntu2.1~18.04.1
    python3-cryptography:amd64 2.1.4-1ubuntu1.2 => 2.1.4-1ubuntu1.3
    python3-distutils:all 3.6.7-1~18.04 => 3.6.8-1~18.04
    python3-gdbm:amd64 3.6.7-1~18.04 => 3.6.8-1~18.04
    python3-lib2to3:all 3.6.7-1~18.04 => 3.6.8-1~18.04
    python3.6-minimal:amd64 3.6.7-1~18.04 => 3.6.8-1~18.04.1
    python3.6-venv:amd64 3.6.7-1~18.04 => 3.6.8-1~18.04.1
    python3.6:amd64 3.6.7-1~18.04 => 3.6.8-1~18.04.1
    systemd-sysv:amd64 237-3ubuntu10.21 => 237-3ubuntu10.22
    systemd:amd64 237-3ubuntu10.21 => 237-3ubuntu10.22
    udev:amd64 237-3ubuntu10.21 => 237-3ubuntu10.22

Login Implementation
================
Im using djangos login views:
settings.py:
    LOGIN_URL = '/accounts/login/'
urls.py:
    path('accounts/', include('django.contrib.auth.urls')),

Error after Login Page of application / and django admin:
========================================
"Internal Server Error
The server encountered an internal error or misconfiguration and was unable 
to complete your request."

Error in Apache Log
==============
[Thu Jun 13 18:58:10.555937 2019] [wsgi:error] [pid 1274:tid 
140451378087680] [client 77.8.21.189:48212] mod_wsgi (pid=1274): Request 
data read error when proxying data to daemon process: Connection reset by 
peer.
[Thu Jun 13 20:46:51.186545 2019] [wsgi:error] [pid 1274:tid 
140451252197120] [client 217.18.178.226:61510] Truncated or oversized 
response headers received from daemon process 'fotobau.ourdomain.de': 
/srv/fotobau/djangoprojekt/wsgi.py, referer: 
https://www.fotobau.ourdomain/accounts/login/

Unfortunately I failed to obtain a core dump till now.

Though right now I suspect the problem occurs when django tries to receive 
the https/encrypted user and password. I suspect this because I got another 
error message!

Another Error in Django Log
====================
Here I got a new error message: The first one ('Exception' is not JSON 
serializable) is fairly common - though I didnĀ“t manage to fix it till now, 
it never really bothered.
Though after the package upgrade it raises a new error message (which will 
raise itself again for 3 times) below - the one with "ImportError: 
/usr/lib/x86_64-linux-gnu/libssl.so.1.1: version `OPENSSL_1_1_1":

ERROR 2019-06-12 19:57:17,638 log 505 Internal Server Error: 
/restservice/v1/fotos/
Traceback (most recent call last):
  File 
"/home/eidle/.virtualenvs/fotobau/lib/python3.6/site-packages/django/core/handlers/exception.py",
 
line 34, in inner
    response = get_response(request)
  File 
"/home/eidle/.virtualenvs/fotobau/lib/python3.6/site-packages/django/core/handlers/base.py",
 
line 156, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File 
"/home/eidle/.virtualenvs/fotobau/lib/python3.6/site-packages/django/core/handlers/base.py",
 
line 154, in _get_response
    response = response.render()
  File 
"/home/eidle/.virtualenvs/fotobau/lib/python3.6/site-packages/django/template/response.py",
 
line 106, in render
    self.content = self.rendered_content
  File 
"/home/eidle/.virtualenvs/fotobau/lib/python3.6/site-packages/rest_framework/response.py",
 
line 72, in rendered_content
    ret = renderer.render(self.data, accepted_media_type, context)
  File 
"/home/eidle/.virtualenvs/fotobau/lib/python3.6/site-packages/rest_framework/renderers.py",
 
line 107, in render
    allow_nan=not self.strict, separators=separators
  File 
"/home/eidle/.virtualenvs/fotobau/lib/python3.6/site-packages/rest_framework/utils/json.py",
 
line 28, in dumps
    return json.dumps(*args, **kwargs)
  File "/usr/lib/python3.6/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "/usr/lib/python3.6/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.6/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File 
"/home/eidle/.virtualenvs/fotobau/lib/python3.6/site-packages/rest_framework/utils/encoders.py",
 
line 68, in default
    return super(JSONEncoder, self).default(obj)
  File "/usr/lib/python3.6/json/encoder.py", line 180, in default
    o.__class__.__name__)
TypeError: Object of type 'Exception' is not JSON serializable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"/home/eidle/.virtualenvs/fotobau/lib/python3.6/site-packages/django/core/handlers/exception.py",
 
line 34, in inner
    response = get_response(request)
  File 
"/home/eidle/.virtualenvs/fotobau/lib/python3.6/site-packages/django/utils/deprecation.py",
 
line 91, in __call__
    response = response or self.get_response(request)
  File 
"/home/eidle/.virtualenvs/fotobau/lib/python3.6/site-packages/django/core/handlers/exception.py",
 
line 36, in inner
    response = response_for_exception(request, exc)
  File 
"/home/eidle/.virtualenvs/fotobau/lib/python3.6/site-packages/django/core/handlers/exception.py",
 
line 95, in response_for_exception
    exc_info=sys.exc_info(),
  File 
"/home/eidle/.virtualenvs/fotobau/lib/python3.6/site-packages/django/utils/log.py",
 
line 228, in log_response
    exc_info=exc_info,
  File "/usr/lib/python3.6/logging/__init__.py", line 1337, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/lib/python3.6/logging/__init__.py", line 1444, in _log
    self.handle(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 1454, in handle
    self.callHandlers(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 1516, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 865, in handle
    self.emit(record)
  File 
"/home/eidle/.virtualenvs/fotobau/lib/python3.6/site-packages/django/utils/log.py",
 
line 122, in emit
    self.send_mail(subject, message, fail_silently=True, 
html_message=html_message)
  File 
"/home/eidle/.virtualenvs/fotobau/lib/python3.6/site-packages/django/utils/log.py",
 
line 125, in send_mail
    mail.mail_admins(subject, message, *args, connection=self.connection(), 
**kwargs)
  File 
"/home/eidle/.virtualenvs/fotobau/lib/python3.6/site-packages/django/utils/log.py",
 
line 128, in connection
    return get_connection(backend=self.email_backend, fail_silently=True)
  File 
"/home/eidle/.virtualenvs/fotobau/lib/python3.6/site-packages/django/core/mail/__init__.py",
 
line 34, in get_connection
    klass = import_string(backend or settings.EMAIL_BACKEND)
  File 
"/home/eidle/.virtualenvs/fotobau/lib/python3.6/site-packages/django/utils/module_loading.py",
 
line 17, in import_string
    module = import_module(module_path)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in 
import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in 
_call_with_frames_removed
  File 
"/home/eidle/.virtualenvs/fotobau/lib/python3.6/site-packages/django/core/mail/backends/smtp.py",
 
line 4, in <module>
    import ssl
  File "/usr/lib/python3.6/ssl.py", line 101, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: /usr/lib/x86_64-linux-gnu/libssl.so.1.1: version 
`OPENSSL_1_1_1' not found (required by 
/usr/lib/python3.6/lib-dynload/_ssl.cpython-36m-x86_64-linux-gnu.so)



Installed libssl/openssl
=================
But openssl ist installed:

apt list -a libssl1.1
Listing... Done
libssl1.1/bionic-updates,bionic-updates,now 1.1.1-1ubuntu2.1~18.04.1 amd64 
[installed]
libssl1.1/bionic-security,bionic-security 1.1.0g-2ubuntu4.3 amd64
libssl1.1/bionic,bionic 1.1.0g-2ubuntu4 amd64

apt list -a openssl
openssl/bionic-updates,bionic-updates,now 1.1.1-1ubuntu2.1~18.04.1 amd64 
[installed]
openssl/bionic-security,bionic-security 1.1.0g-2ubuntu4.3 amd64
openssl/bionic,bionic 1.1.0g-2ubuntu4 amd64


The python part is confusing me right now:

apt list -a python3
Listing... Done
python3/bionic-updates,bionic-updates,now 3.6.7-1~18.04 amd64 [installed]
python3/bionic,bionic 3.6.5-3 amd64

But:
apt list -a python3.6
Listing... Done
python3.6/bionic-updates,bionic-updates,now 3.6.8-1~18.04.1 amd64 
[installed]
python3.6/bionic,bionic 3.6.5-3 amd64

And when I run:

python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.

And in the venv:
(fotobau) eidle@test:/$ python
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/841ed8aa-a7bd-4b95-a57e-59877aaa9e7b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to