idlesign/django-sitetree

Maximum recursion depth exceeded

m32w opened this issue · 2 comments

m32w commented

full_error.log
Hi Team,

I found this project suburb, but I have found the critical issue that corrupted DB. When I moved item from root in this case it was 1 default element to 3 level it generated this logs, i had to recreate db ;(

Request Method: GET
http://localhost:8000/admin/sitetree/tree/1/change/
1.11
RecursionError
maximum recursion depth exceeded
full_error.log

c:\xampp\htdocs\django_envs\django_1_11\lib\site-packages\django_sitetree-1.9.0-py3.6.egg\sitetree\sitetreeapp.py in get_item_by_id, line 585
c:\xampp\htdocs\django_envs\django_1_11\Scripts\python.exe
3.6.3
['', '', 'c:\xampp\htdocs\django_envs\django_1_11\tests\django-sitetree\demo', 'c:\xampp\htdocs\django_envs\django_1_11\Scripts\python36.zip', 'c:\xampp\htdocs\django_envs\django_1_11\DLLs', 'c:\xampp\htdocs\django_envs\django_1_11\lib', 'c:\xampp\htdocs\django_envs\django_1_11\Scripts', 'c:\users\mwisniewski\appdata\local\programs\python\python36\Lib', 'c:\users\mwisniewski\appdata\local\programs\python\python36\DLLs', 'c:\xampp\htdocs\django_envs\django_1_11', 'c:\xampp\htdocs\django_envs\django_1_11\lib\site-packages', 'c:\xampp\htdocs\django_envs\django_1_11\lib\site-packages\django_sitetree-1.9.0-py3.6.egg', 'c:\xampp\htdocs\django_envs\django_1_11\lib\site-packages\django_simple_menu-1.2.1-py3.6.egg', 'c:\xampp\htdocs\django_envs\django_1_11\lib\site-packages']
Wed, 20 Dec 2017 18:40:34 +0000

Hi,

[...] the critical issue that corrupted DB

What you call a DB corruption is nothing more than a hand-made endless recursion with only application impact: this can be easily reproduced if you attach an item that has children under one of these. There is already a sanity-check to prevent setting item as a parent of itself, and if you want to evolve it to cover your case (without big performance penalty), pull request is certainly welcome.

No need to recreate db, by the way: just set back an appropriate parent (e.g. None).

Considered closed.
Feel free to reopen if required.