Re: Isn't TypeError built in?
Thanks Peter ... the problem was all mine.Can't quite remember what it was exactly but I introduced a bug in my own code and it manifested down there in the bowels of the snake.I suppose that indicates a possible kink to be ironed out and if that interests you I am happy to retrace my steps and describe it.Fyi, there was nothing out of kilter in the machine. It was in production and is stable.CheersMike--(Unsigned mail from my phone) Original message From: "Peter J. Holzer" Date: 26/12/21 06:19 (GMT+10:00) To: python-list@python.org Subject: Re: Isn't TypeError built in? On 2021-12-13 12:22:28 +1100, Mike Dewhirst via Python-list wrote:> Obviously something is wrong elsewhere but I'm not sure where to look.> Ubuntu 20.04 with plenty of RAM.[...]> [Mon Dec 13 01:15:49.885659 2021] [mpm_event:notice] [pid 1033:tid> 140446449658944] AH00489: Apache/2.4.41 (Ubuntu) SVN/1.13.0 OpenSSL/1.1.1f> mod_wsgi/4.6.8 Python/3.8 configured -- resuming normal operations> [Mon Dec 13 01:15:49.885664 2021] [core:notice] [pid 1033:tid> 140446449658944] AH00094: Command line: '/usr/sbin/apache2'> Exception ignored in: > Traceback (most recent call last):> File "/usr/local/lib/python3.8/dist-packages/asgiref/local.py", line 96,> in __del__> NameError: name 'TypeError' is not definedDid you upgrade the OS recently and do you use virtual environents withmod_wsgi?"Impossible" errors like the above are common when the virtualenvironment was built with a different (older) version of the Pythoninterpreter than the one trying to use it. Nuking and rebuilding thevirtual environment is usually the quickest way to fix it. hp-- _ | Peter J. Holzer | Story must make more sense than reality.|_|_) | || | | h...@hjp.at | -- Charles Stross, "Creative writing__/ | http://www.hjp.at/ | challenge!"-- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Isn't TypeError built in?
On 2021-12-13 12:22:28 +1100, Mike Dewhirst via Python-list wrote: > Obviously something is wrong elsewhere but I'm not sure where to look. > Ubuntu 20.04 with plenty of RAM. [...] > [Mon Dec 13 01:15:49.885659 2021] [mpm_event:notice] [pid 1033:tid > 140446449658944] AH00489: Apache/2.4.41 (Ubuntu) SVN/1.13.0 OpenSSL/1.1.1f > mod_wsgi/4.6.8 Python/3.8 configured -- resuming normal operations > [Mon Dec 13 01:15:49.885664 2021] [core:notice] [pid 1033:tid > 140446449658944] AH00094: Command line: '/usr/sbin/apache2' > Exception ignored in: > Traceback (most recent call last): > File "/usr/local/lib/python3.8/dist-packages/asgiref/local.py", line 96, > in __del__ > NameError: name 'TypeError' is not defined Did you upgrade the OS recently and do you use virtual environents with mod_wsgi? "Impossible" errors like the above are common when the virtual environment was built with a different (older) version of the Python interpreter than the one trying to use it. Nuking and rebuilding the virtual environment is usually the quickest way to fix it. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Description: PGP signature -- https://mail.python.org/mailman/listinfo/python-list
Re: Isn't TypeError built in?
On 13/12/2021 12:42 pm, Chris Angelico wrote: On Mon, Dec 13, 2021 at 12:31 PM Mike Dewhirst via Python-list wrote: Obviously something is wrong elsewhere but I'm not sure where to look. Ubuntu 20.04 with plenty of RAM. def __del__(self): try: for context_obj in self._context_refs: try: delattr(context_obj, self._attr_name) except AttributeError: pass except TypeError:# THIS IS LINE 96 IN THE APACHE2 ERROR LOG BELOW # WeakSet.__iter__ can crash when interpreter is shutting down due # to _IterationGuard being None. pass [Mon Dec 13 01:15:49.875993 2021] [mpm_event:notice] [pid 1033:tid 140446449658944] AH00493: SIGUSR1 received. Doing graceful restart [Mon Dec 13 01:15:49.878443 2021] [so:warn] [pid 1033] AH01574: module dav_module is already loaded, skipping [Mon Dec 13 01:15:49.885659 2021] [mpm_event:notice] [pid 1033:tid 140446449658944] AH00489: Apache/2.4.41 (Ubuntu) SVN/1.13.0 OpenSSL/1.1.1f mod_wsgi/4.6.8 Python/3.8 configured -- resuming normal operations [Mon Dec 13 01:15:49.885664 2021] [core:notice] [pid 1033:tid 140446449658944] AH00094: Command line: '/usr/sbin/apache2' Exception ignored in: Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/asgiref/local.py", line 96, in __del__ NameError: name 'TypeError' is not defined Exception ignored in: Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/asgiref/local.py", line 96, in __del__ NameError: name 'TypeError' is not defined Any hints welcome ... During interpreter shutdown, all kinds of things can go weird. The order that things get destroyed isn't always clearly defined. Is it possible to do the cleanup work before interpreter shutdown? Alternatively: maybe take a local reference to the exception types you need to refer to (just "AttributeError = AttributeError" at top level should do it), which should keep them alive longer (I think). Worst case, capture *all* exceptions, then look at e.__class__.__name__ and match on that. ChrisA OK - not solved but resolved anyway. The Django project was failing on the new server and working fine in dev. The problem seems to be a mis-export from an old subversion repo.The project was being reconstituted on a new staging server from a reloaded svn dump from the old (ancient) svn server to the new svn server on the same machine. Resolution "happened" when I updated the (c) notice in all source files and recommitted to the new server and re-exported from that. The repo looks fine. The log is all there back to the beginning. As a test I have deployed from an earlier revision and that all works. It's either a miracle or I did something else (which I didn't notice) which fixed it. Thanks to everyone for thinking about this. Cheers Mike -- Signed email is an absolute defence against phishing. This email has been signed with my private key. If you import my public key you can automatically decrypt my signature and be sure it came from me. Just ask and I'll send it to you. Your email software can handle signing. OpenPGP_signature Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list
Re: Isn't TypeError built in?
On Mon, Dec 13, 2021 at 12:31 PM Mike Dewhirst via Python-list wrote: > > Obviously something is wrong elsewhere but I'm not sure where to look. > Ubuntu 20.04 with plenty of RAM. > > def __del__(self): > try: > for context_obj in self._context_refs: > try: > delattr(context_obj, self._attr_name) > except AttributeError: > pass > > except TypeError:# THIS IS LINE 96 IN THE APACHE2 ERROR > LOG BELOW > > # WeakSet.__iter__ can crash when interpreter is shutting > down due > # to _IterationGuard being None. > pass > > [Mon Dec 13 01:15:49.875993 2021] [mpm_event:notice] [pid 1033:tid > 140446449658944] AH00493: SIGUSR1 received. Doing graceful restart > [Mon Dec 13 01:15:49.878443 2021] [so:warn] [pid 1033] AH01574: module > dav_module is already loaded, skipping > [Mon Dec 13 01:15:49.885659 2021] [mpm_event:notice] [pid 1033:tid > 140446449658944] AH00489: Apache/2.4.41 (Ubuntu) SVN/1.13.0 > OpenSSL/1.1.1f mod_wsgi/4.6.8 Python/3.8 configured -- resuming normal > operations > [Mon Dec 13 01:15:49.885664 2021] [core:notice] [pid 1033:tid > 140446449658944] AH00094: Command line: '/usr/sbin/apache2' > Exception ignored in: > Traceback (most recent call last): >File "/usr/local/lib/python3.8/dist-packages/asgiref/local.py", line > 96, in __del__ > NameError: name 'TypeError' is not defined > Exception ignored in: > Traceback (most recent call last): >File "/usr/local/lib/python3.8/dist-packages/asgiref/local.py", line > 96, in __del__ > NameError: name 'TypeError' is not defined > > Any hints welcome ... During interpreter shutdown, all kinds of things can go weird. The order that things get destroyed isn't always clearly defined. Is it possible to do the cleanup work before interpreter shutdown? Alternatively: maybe take a local reference to the exception types you need to refer to (just "AttributeError = AttributeError" at top level should do it), which should keep them alive longer (I think). Worst case, capture *all* exceptions, then look at e.__class__.__name__ and match on that. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Isn't TypeError built in?
Yes, TypeError is built in. The only thing I can think of is that something has deleted `TypeError` from `__builtins__`? It would be interesting to see what's in `__builtins__` when `__del__` is called. On Mon, 2021-12-13 at 12:22 +1100, Mike Dewhirst via Python-list wrote: > Obviously something is wrong elsewhere but I'm not sure where to > look. > Ubuntu 20.04 with plenty of RAM. > > def __del__(self): > try: > for context_obj in self._context_refs: > try: > delattr(context_obj, self._attr_name) > except AttributeError: > pass > > except TypeError: # THIS IS LINE 96 IN THE APACHE2 > ERROR > LOG BELOW > > # WeakSet.__iter__ can crash when interpreter is > shutting > down due > # to _IterationGuard being None. > pass > > [Mon Dec 13 01:15:49.875993 2021] [mpm_event:notice] [pid 1033:tid > 140446449658944] AH00493: SIGUSR1 received. Doing graceful restart > [Mon Dec 13 01:15:49.878443 2021] [so:warn] [pid 1033] AH01574: > module > dav_module is already loaded, skipping > [Mon Dec 13 01:15:49.885659 2021] [mpm_event:notice] [pid 1033:tid > 140446449658944] AH00489: Apache/2.4.41 (Ubuntu) SVN/1.13.0 > OpenSSL/1.1.1f mod_wsgi/4.6.8 Python/3.8 configured -- resuming > normal > operations > [Mon Dec 13 01:15:49.885664 2021] [core:notice] [pid 1033:tid > 140446449658944] AH00094: Command line: '/usr/sbin/apache2' > Exception ignored in: > Traceback (most recent call last): > File "/usr/local/lib/python3.8/dist-packages/asgiref/local.py", > line > 96, in __del__ > NameError: name 'TypeError' is not defined > Exception ignored in: > Traceback (most recent call last): > File "/usr/local/lib/python3.8/dist-packages/asgiref/local.py", > line > 96, in __del__ > NameError: name 'TypeError' is not defined > > Any hints welcome ... > > Thanks > > Mike > > -- > Signed email is an absolute defence against phishing. This email has > been signed with my private key. If you import my public key you can > automatically decrypt my signature and be sure it came from me. Just > ask and I'll send it to you. Your email software can handle signing. > -- https://mail.python.org/mailman/listinfo/python-list
Isn't TypeError built in?
Obviously something is wrong elsewhere but I'm not sure where to look. Ubuntu 20.04 with plenty of RAM. def __del__(self): try: for context_obj in self._context_refs: try: delattr(context_obj, self._attr_name) except AttributeError: pass except TypeError: # THIS IS LINE 96 IN THE APACHE2 ERROR LOG BELOW # WeakSet.__iter__ can crash when interpreter is shutting down due # to _IterationGuard being None. pass [Mon Dec 13 01:15:49.875993 2021] [mpm_event:notice] [pid 1033:tid 140446449658944] AH00493: SIGUSR1 received. Doing graceful restart [Mon Dec 13 01:15:49.878443 2021] [so:warn] [pid 1033] AH01574: module dav_module is already loaded, skipping [Mon Dec 13 01:15:49.885659 2021] [mpm_event:notice] [pid 1033:tid 140446449658944] AH00489: Apache/2.4.41 (Ubuntu) SVN/1.13.0 OpenSSL/1.1.1f mod_wsgi/4.6.8 Python/3.8 configured -- resuming normal operations [Mon Dec 13 01:15:49.885664 2021] [core:notice] [pid 1033:tid 140446449658944] AH00094: Command line: '/usr/sbin/apache2' Exception ignored in: Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/asgiref/local.py", line 96, in __del__ NameError: name 'TypeError' is not defined Exception ignored in: Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/asgiref/local.py", line 96, in __del__ NameError: name 'TypeError' is not defined Any hints welcome ... Thanks Mike -- Signed email is an absolute defence against phishing. This email has been signed with my private key. If you import my public key you can automatically decrypt my signature and be sure it came from me. Just ask and I'll send it to you. Your email software can handle signing. OpenPGP_signature Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list