-
-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Parsing a simple script eats all of your memory #45475
Comments
Read the WARNING below, then run the attached script with Python3.0a2. WARNING: Keep a process killing tool or an extra command line at your OS: Ubuntu Feisty, up-to-date |
Confirmed on Windows: OS: Windows XP SP2 ENG |
Works fine (does nothing) with Python 2.4.4 and Python 2.5.1 under Windows, so this bug must be caused by some new code in Python3.0a1. The bug depends on the contents of the doc string. There's another strange behavior if you write the word "this" in the docstring somewhere. The docstring could be parsed as source code somehow and causes strange things to the new parser. |
Errata: In the first line of my original post I mean Python3.0a1 and not |
Confirmed that this happens on Mac OS X with a fresh build of py3k from svn. |
Same under Linux with Python 3.0a1. |
--- tokenizer.c (revision 58161)
+++ tokenizer.c (working copy)
@@ -402,6 +402,8 @@
if (allocated) {
Py_DECREF(bufobj);
}
+ Py_XDECREF(tok->decoding_buffer);
+ tok->decoding_buffer = 0;
return s; |
Note the patch is inlined in a message. |
Oops, i see there are two bugs. Previously i have fixed multiline I think it will be: Index: tokenizer.c --- tokenizer.c (revision 58161)
+++ tokenizer.c (working copy)
@@ -395,6 +395,7 @@
goto error;
buflen = size;
}
+
memcpy(s, buf, buflen);
s[buflen] = '\0';
if (buflen == 0) /* EOF */
@@ -402,6 +403,12 @@
if (allocated) {
Py_DECREF(bufobj);
}
+
+ if ( bufobj == tok->decoding_buffer ){
+ Py_XDECREF(tok->decoding_buffer);
+ tok->decoding_buffer = 0;
+ }
+
return s;
error: |
Confirmed problem (used 4.5GB before I killed it), and that the second Bumping the priority to high because the side effect can cause all sorts |
It looks to me like fp_readl is no longer working as designed and the |
The issue isn't fixed yet. The script is still eating precious memory. |
Amaury, can you have a look at this? I think it's a bug in tok_nextc() |
This bug prevents me and many others to do preliminary testing on Py3k, Sadly I've not enough free time and readily available in-depth knowledge |
I've already raised the priority to draw more attention to this bug. So far I'm not able to solve the bug but I've nailed down the issue to a HANGS: The problem manifests itself only in the combination of the ascii WORKS: WORKS: WORKS: DOESN'T COMPILE: The latest example does compile with Python 2.5. Please note also the During my debugging session I saw an infinite loop in tokenzize.c:1429 letter_quote:
/* String */
if (c == '\'' || c == '"') {
...
for (;;) {
INFINITE LOOP
} |
Is this also broken in the 3.0a1 release? If not, it might be useful |
1 similar comment
Is this also broken in the 3.0a1 release? If not, it might be useful |
fp_readl is indeed broken in several ways:
IOW, the function is always wrong ;-) I have a correction ready (jafo's patch already addresses the first |
In response to Guido: According to pythonmeister's post (2007-09-10): "Same under Linux with Python 3.0a1. I found the bug with this version: fviktor@rigel:~$ python3.0 --version AFAIK it is the latest alpha released. Viktor (complex) |
Corrected in revision 59001, with a modified patch. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: