`NameError: name 'TypeError' is not defined` in Apache (mod_wsgi)
Asked Answered
A

2

8

Install Version

Apache

  • apr-1.6.5
  • apr-util-1.6.1
  • httpd-2.4.7
  • mod_wsgi-4.6.8
  • pcre-8.32

Python

  • 3.8.5

Django

  • 3.1.2

Apache http.conf

Listen 3600
WSGISocketPrefix /var/run/wsgi
<VirtualHost *:3600>
    WSGIDaemonProcess project_name display-name=project_name
    WSGIScriptAlias / /data/project_name/config/wsgi.py  process-group=api application-group=api
    ServerName project_name
    <Directory /data/project_name/config>
        Order allow,deny
        Allow from all
        Require all granted
        <Files wsgi.py>
            Require all granted
        </Files>
    </Directory>
</VirtualHost>

Error log

Exception ignored in: <function Local.__del__ at 0x7fd675a70a60>
Traceback (most recent call last):
  File "/data/venv/api/lib/python3.8/site-packages/asgiref/local.py", line 96, in __del__
NameError: name 'TypeError' is not defined

The above error log is coming out over and over and over again.
I don't know why there is an asgi related error when I don't use asgi.

Aborticide answered 4/11, 2020 at 4:50 Comment(6)
I observe this, too, since today. TypeError is a Python built-in. Possibly, this is a race while the Python interpreter is shutting down?Excoriation
@TorstenBronger Hi, No error occurred if option WSGIDaemonProcess was not used. Is there any other solution?Loutitia
Unfortunately, it was a “Heisenbug” for me – while troubleshooting it, it went away for other reasons.Excoriation
Same here after upgrading python3-distupgrade. Maybe this package update causes the issue?Benelux
How to fix it? Upgrading python3-distupgrade didn't help.Geoponics
Did you solve this error? I am having the same issue.Vituperate
G
1

I had the same problem after a system update

After the update, the module wsgi was not enabled anymore. Hence enabling it solved the problem

In Ubuntu I executed

sudo a2enmod wsgi

This link has some related information

Goodspeed answered 6/12, 2022 at 10:19 Comment(0)
D
0

I saw the same similar things in my logs, only during apache shutdown (and thus restart). It is probably background threads still running while the python interpreter is being shut down, as answered by @GrahamDumpleton in a similar-style question (with different errors) several years ago. See NameError: name 'hasattr' is not defined - Python3.6, Django1.11, Ubuntu16-17, Apache2.4, mod_wsgi

Demonstrate answered 17/5, 2021 at 20:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.