dcramer / django-devserver

A drop-in replacement for Django's runserver.
BSD 3-Clause "New" or "Revised" License
1.27k stars 158 forks source link

Inifinite recursion in sql module #92

Closed sicarrots closed 10 years ago

sicarrots commented 11 years ago

Running django application through devserver (django 1.6rc, devserver 0.7.0) causes infinite recursion error on line 77 devserver/modules/sql.py return super(DatabaseStatTracker, self).execute(sql, params)

un33k commented 11 years ago

more info: https://code.djangoproject.com/ticket/21348

kosz85 commented 11 years ago

Hi :) It's because you monkeypatch util.CursorDebugWrapper and inherit from it in same time. So when you call super(DatabaseStatTracker, self).execute it goes to real CursorDebugWrapper but then it takes util.CursorDebugWrapper which is already DatabaseStatTracker, so it reality do again super(DatabaseStatTracker, self).execute and loops. It should not monkeypatch util, or inherit from CursorWrapper and reimplement it. As quick fix you can just change in line 52 from util.CursorDebugWrapper to util.CursorWrapper but it's not fully correct fix, as it don't execute CursorDebugWrapper code. More like some django setting to change CursorWrapper is needed.

jsgsm commented 10 years ago

I can confirm this behavior. Infinite recursion using stock Django 1.6 and Devserver 0.7.0. (No monkeypatch)

RuntimeError at /admin/
maximum recursion depth exceeded while calling a Python object
Request Method: GET
Request URL:    http://**************/admin/
Django Version: 1.6
Exception Type: RuntimeError
Exception Value:    
maximum recursion depth exceeded while calling a Python object
Exception Location: /home/dev1/.virtualenvs/gsm/lib/python2.6/site-packages/django/utils/encoding.py in force_text, line 98
Python Executable:  /home/dev1/.virtualenvs/gsm/bin/python
Python Version: 2.6.6
foxx commented 10 years ago

This has now been merged in 0.8.0 as per #96. Can be marked as closed.