Richard Liao
2008-08-24 01:59:03 UTC
Hi all.
I have met a trac crash when I was trying to create new ticket or
access admin pages.
The trac crashes hardly with error: "segmentation fault" in my FreeBSD box.
After some digging, I found the problem lays in genshi's transform module.
The following is a test script to reproduce that hard crashe by
setting recursion limit exceeds the platform's capabilities:
import sys
from genshi.input import HTML
from genshi.builder import tag
from genshi.filters.transform import Transformer
sys.setrecursionlimit(1000 * 20)
stream = HTML('<html><head><title>Some Title</title></head>'
'<body>Some <em>body</em> text.</body></html>')
for i in xrange(1000 * 10):
stream = stream | Transformer('body').prepend(tag.h1('Document Title'))
print stream.render()
If comment out setrecursionlimit line to use system default recursion
limit, it raises exception: "RuntimeError: maximum recursion depth
exceeded".
File ".../genshi/filters/transform.py", line 686, in _unmark
for mark, event in stream:
File ".../genshi/filters/transform.py", line 1129, in __call__
for mark, event in stream:
File ".../genshi/filters/transform.py", line 713, in __call__
for mark, event in stream:
File ".../genshi/filters/transform.py", line 682, in _mark
for event in stream:
File ".../genshi/core.py", line 267, in _ensure
event = stream.next()
File ".../genshi/filters/transform.py", line 686, in _unmark
for mark, event in stream:
File ".../genshi/filters/transform.py", line 1129, in __call__
for mark, event in stream:
File ".../genshi/filters/transform.py", line 713, in __call__
for mark, event in stream:
File ".../genshi/filters/transform.py", line 682, in _mark
for event in stream:
File ".../genshi/core.py", line 267, in _ensure
event = stream.next()
...
The problem is that the transform module is in very deep and unlimited
recursion.
I think it's a problem in genshi, maybe also in trac?
I am not sure why trac crashes siliently with no exception raised
after I searched trac source codes but can't find any lines about
setrecursionlimit.
Has anyone got the same situation?
Regards,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac Development" group.
To post to this group, send email to trac-***@googlegroups.com
To unsubscribe from this group, send email to trac-dev+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---
I have met a trac crash when I was trying to create new ticket or
access admin pages.
The trac crashes hardly with error: "segmentation fault" in my FreeBSD box.
After some digging, I found the problem lays in genshi's transform module.
The following is a test script to reproduce that hard crashe by
setting recursion limit exceeds the platform's capabilities:
import sys
from genshi.input import HTML
from genshi.builder import tag
from genshi.filters.transform import Transformer
sys.setrecursionlimit(1000 * 20)
stream = HTML('<html><head><title>Some Title</title></head>'
'<body>Some <em>body</em> text.</body></html>')
for i in xrange(1000 * 10):
stream = stream | Transformer('body').prepend(tag.h1('Document Title'))
print stream.render()
If comment out setrecursionlimit line to use system default recursion
limit, it raises exception: "RuntimeError: maximum recursion depth
exceeded".
File ".../genshi/filters/transform.py", line 686, in _unmark
for mark, event in stream:
File ".../genshi/filters/transform.py", line 1129, in __call__
for mark, event in stream:
File ".../genshi/filters/transform.py", line 713, in __call__
for mark, event in stream:
File ".../genshi/filters/transform.py", line 682, in _mark
for event in stream:
File ".../genshi/core.py", line 267, in _ensure
event = stream.next()
File ".../genshi/filters/transform.py", line 686, in _unmark
for mark, event in stream:
File ".../genshi/filters/transform.py", line 1129, in __call__
for mark, event in stream:
File ".../genshi/filters/transform.py", line 713, in __call__
for mark, event in stream:
File ".../genshi/filters/transform.py", line 682, in _mark
for event in stream:
File ".../genshi/core.py", line 267, in _ensure
event = stream.next()
...
The problem is that the transform module is in very deep and unlimited
recursion.
I think it's a problem in genshi, maybe also in trac?
I am not sure why trac crashes siliently with no exception raised
after I searched trac source codes but can't find any lines about
setrecursionlimit.
Has anyone got the same situation?
Regards,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac Development" group.
To post to this group, send email to trac-***@googlegroups.com
To unsubscribe from this group, send email to trac-dev+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---