title: Apache crashing from django.contrib class WKBWriter/Reader
body: <p>I'm running a django application on an apache webserver. This application uses the django.contrib package, specifically django.contrib.gis.geos.</p>
  
  <p>Now sometimes this works out well for weeks, only to come crashing down multiple times a day with seemingly no direct correlation to user interaction.</p>
  
  <p>The log shows this:</p>
  
  <p><code>Traceback (most recent call last):
    File "[...]/lib/python3.4/site-packages/django/contrib/gis/ptr.py", line 37, in __del__
  NameError: name 'AttributeError' is not defined
  [...] Exception ignored in: Exception ignored in: Exception ignored in: &lt;bound method _WKBReader.__del__ of &lt;django.contrib.gis.geos.prototypes.io._WKBReader object at 0x7ff4c2f92a58&gt;&gt;</code></p>
  
  <p>I have shortened the huge chain of <code>Exception ignored in:</code>s.
  After this, apache won't serve any more requests until it is restarted but also still remain active as a daemon.</p>
  
  <p>I am not sure which line exactly is responsible for this error. But I found this: 
  <a href="https://docs.djangoproject.com/en/2.2/ref/contrib/gis/geos/#creating-a-geometry" rel="nofollow noreferrer">https://docs.djangoproject.com/en/2.2/ref/contrib/gis/geos/#creating-a-geometry</a>
  Under "My logs are filled with GEOS-related errors"
  it says that this could be avoided by not having any GEOS-Objects created on top level, so I tried to purge those occurrences but it didn't help.
  Also it seems weird to see <code>NameError: name 'AttributeError' is not defined</code> maybe that can hint to the root of this problem?</p>
  
  <p>If you do not know how to instantly solve this, can you give me some insights on how to avoid it? 
  Not using the package at all is possible but I really want to keep that as a last resort.</p>
  
  <p>Thanks for your help.</p>