-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Traceback formatting in Python 3.6 32-bit Windows causes hang #1162
Comments
This comment has been minimized.
This comment has been minimized.
Which version of Jinja is that? The traceback must not have loops which to me would indicate that this is potentially a regression in Jinja. |
This comment has been minimized.
This comment has been minimized.
I'm having trouble reproducing this. I used your exact code and the mentioned versions, and got the expected traceback, not a reference loop or hang. Just in case, I also tested with the latest Werkzeug and Jinja versions and didn't see the issue either. |
This comment has been minimized.
This comment has been minimized.
@mitsuhiko Jinja2 2.11.1 |
This comment has been minimized.
This comment has been minimized.
@davidism hope it's helpful. |
I am not sure if my environment will impact it. But I tried running it directly in command line. It's the same. |
Can you check if this also happens on 2.10? |
I can reproduce this with 2.11 on Python 3.6.8 32-bit on Windows. Python 3.6.8 64-bit does not have the issue. 2.10.3 does not have the issue. from jinja2 import Template
Template("{{ a-b }}").render() |
Looks like a bad assumption about the size of ctypes.c_byte * (32 if hasattr(sys, "getobjects") else 16) to ctypes.c_byte * object().__sizeof__() fixes the issue. On Python 3.6 32-bit, the size is actually 8, not 32 or 16, so the wrong slot was being written to when setting |
Hi,
I was facing an issue when using incorrect variable name in
Flask
template. An dash "-" linked variable name in template cause Flask to hang without throwing any exception.At first I doubt it's
Jinja
issue but I found Jinja raised the exception andWerkzeug
handled it.Eventually, I found an endless loop in
Python\Lib\traceback.py
to walk trackback stacks. Thetrackbacks are stored in a link which nodes point to next. In
flask\templating.py
,flask\app.py
andwerkzeug\debug\tbtools.py
, the exception was catched. Inhandle_exception()
offlask\app.py
,Werkzeug
wants to log it and print it out.The trackback link has looped reference as below picture.
Hope its helpful. Thanks you.
Expected Behavior
Render variable out or throw exception out.
Actual Behavior
App hangs.
Environment
The text was updated successfully, but these errors were encountered: