Opened 11 years ago

Closed 11 years ago

#21607 closed Bug (invalid)

RuntimeError: maximum recursion depth exceeded in "django.contrib.gis.db.backends.postgis.operations"

Reported by: gueux <gueux+django@…> Owned by: nobody
Component: GIS Version: 1.6
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

There seems to be a bug in django/contrib/gis/db/backends/postgis/operations.py...
I have postgis 2.1.0 installed (weird, as the tests seems to match version < 1.3.4...) and manually setting POSTGIS_VERSION = "2.1.0" in my settings.py seems to fix the issue.

Traceback (most recent call last):
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/usr/lib/python2.7/dist-packages/django/contrib/staticfiles/handlers.py", line 67, in __call__
    return self.application(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 194, in __call__
    signals.request_started.send(sender=self.__class__)
  File "/usr/lib/python2.7/dist-packages/django/dispatch/dispatcher.py", line 185, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/usr/lib/python2.7/dist-packages/django/db/__init__.py", line 81, in reset_queries
    for conn in connections.all():
  File "/usr/lib/python2.7/dist-packages/django/db/utils.py", line 213, in all
    return [self[alias] for alias in self]
  File "/usr/lib/python2.7/dist-packages/django/db/utils.py", line 199, in __getitem__
    conn = backend.DatabaseWrapper(db, alias)
  File "/usr/lib/python2.7/dist-packages/django/contrib/gis/db/backends/postgis/base.py", line 11, in __init__
    self.ops = PostGISOperations(self)
  File "/usr/lib/python2.7/dist-packages/django/contrib/gis/db/backends/postgis/operations.py", line 158, in __init__
    if self.spatial_version < (1, 3, 4):
  File "/usr/lib/python2.7/dist-packages/django/utils/functional.py", line 49, in __get__
    res = instance.__dict__[self.func.__name__] = self.func(instance)
  File "/usr/lib/python2.7/dist-packages/django/contrib/gis/db/backends/postgis/operations.py", line 252, in spatial_version
    vtup = self.postgis_version_tuple()
  File "/usr/lib/python2.7/dist-packages/django/contrib/gis/db/backends/postgis/operations.py", line 426, in postgis_version_tuple
    version = self.postgis_lib_version()
  File "/usr/lib/python2.7/dist-packages/django/contrib/gis/db/backends/postgis/operations.py", line 406, in postgis_lib_version
    return self._get_postgis_func('postgis_lib_version')
  File "/usr/lib/python2.7/dist-packages/django/contrib/gis/db/backends/postgis/operations.py", line 397, in _get_postgis_func
    cursor.execute('SELECT %s()' % func)
  File "/home/gueux/cartoterra/cartoterra-env/local/lib/python2.7/site-packages/debug_toolbar/utils/tracking/db.py", line 152, in execute
    'trans_id': self.logger.get_transaction_id(alias),
  File "/home/gueux/cartoterra/cartoterra-env/local/lib/python2.7/site-packages/debug_toolbar/panels/sql.py", line 83, in get_transaction_id
    conn = connections[alias].connection
  File "/usr/lib/python2.7/dist-packages/django/db/utils.py", line 199, in __getitem__
    conn = backend.DatabaseWrapper(db, alias)
  File "/usr/lib/python2.7/dist-packages/django/contrib/gis/db/backends/postgis/base.py", line 11, in __init__
    self.ops = PostGISOperations(self)
  File "/usr/lib/python2.7/dist-packages/django/contrib/gis/db/backends/postgis/operations.py", line 158, in __init__
    if self.spatial_version < (1, 3, 4):

[...]

  File "/usr/lib/python2.7/dist-packages/django/utils/functional.py", line 49, in __get__
    res = instance.__dict__[self.func.__name__] = self.func(instance)
  File "/usr/lib/python2.7/dist-packages/django/contrib/gis/db/backends/postgis/operations.py", line 252, in spatial_version
    vtup = self.postgis_version_tuple()
  File "/usr/lib/python2.7/dist-packages/django/contrib/gis/db/backends/postgis/operations.py", line 426, in postgis_version_tuple
    version = self.postgis_lib_version()
  File "/usr/lib/python2.7/dist-packages/django/contrib/gis/db/backends/postgis/operations.py", line 406, in postgis_lib_version
    return self._get_postgis_func('postgis_lib_version')
  File "/usr/lib/python2.7/dist-packages/django/contrib/gis/db/backends/postgis/operations.py", line 396, in _get_postgis_func
    with self.connection.temporary_connection() as cursor:
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/usr/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 515, in temporary_connection
    cursor = self.cursor()
RuntimeError: maximum recursion depth exceeded

Change History (4)

comment:1 by Claude Paroz, 11 years ago

Did you test this on 1.6.1? If not can you try? This might have been fixed by [432de54611394].

in reply to:  1 comment:2 by gueux <gueux+django@…>, 11 years ago

Replying to claudep:

Did you test this on 1.6.1? If not can you try? This might have been fixed by [432de54611394].

Sorry for haven't specified it initially, but I am already using 1.6.1.

comment:3 by Claude Paroz, 11 years ago

The problem is that there is a circular dependency between self.spatial_version and debug_toolbar self.logger.get_transaction_id. Might be worth checking with a debug_toolbar maintainer, because my initial feeling is that it's not Django's problem.

comment:4 by Aymeric Augustin, 11 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top