﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
25657	gevent-monkeypatching with GIS PointField causes intermittent traceback on shutdown	James Addison	nobody	"With the following model and a management command script that creates several instances of this model - some with `point = None` - I get a traceback on shutdown of the management command script. Note that the instances are created/saved to the database perfectly fine. I also am '''unable to reproduce''' without gevent.

{{{
from django.contrib.gis.db import models

class Provider(models.Model):
    point = models.PointField(blank=True, null=True)
}}}

Management script:

{{{
from django.contrib.gis.geos import Point
from django.core.management import BaseCommand
from businesses.models import Provider

class Command(BaseCommand):
    def handle(self, *args, **options):
        for i in range(100):
            Provider.objects.create(
                point=Point(-123.329773, 48.407326)
            )
            Provider.objects.create(
                point=None
            )
}}}

Finally, the traceback:

{{{
(geos_exception)vagrant@vagrant-ubuntu-trusty-64:/vagrant/geos_exception$ ./manage.py testcomm --settings=geos_exception.settings
Exception ignored in: <bound method WKBWriter.__del__ of <django.contrib.gis.geos.prototypes.io.WKBWriter object at 0x7f7b62d85198>>
Traceback (most recent call last):
  File ""/home/vagrant/.virtualenvs/geos_exception/lib/python3.4/site-packages/django/contrib/gis/geos/prototypes/io.py"", line 137, in __del__
  File ""/home/vagrant/.virtualenvs/geos_exception/lib/python3.4/site-packages/django/contrib/gis/geos/libgeos.py"", line 157, in __call__
  File ""/home/vagrant/.virtualenvs/geos_exception/lib/python3.4/site-packages/django/contrib/gis/geos/prototypes/threadsafe.py"", line 52, in __call__
  File ""/home/vagrant/.virtualenvs/geos_exception/lib/python3.4/site-packages/gevent/local.py"", line 246, in __getattribute__
TypeError: 'NoneType' object is not callable
}}}

I am attached a tar.gz file containing the test project. Remember, this issue is intermittent - I can run the management command a time or two without traceback before seeing the problem."	Bug	closed	GIS	1.9	Normal	fixed	gevent		Ready for checkin	1	0	0	0	0	0
