[Python-bugs-list] [ python-Bugs-783312 ] Serious mem leak in
socket module
SourceForge.net
noreply at sourceforge.net
Wed Oct 15 03:15:03 EDT 2003
Bugs item #783312, was opened at 2003-08-05 06:13
Message generated for change (Comment added) made by iscorinne
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=783312&group_id=5470
Category: Python Library
Group: Python 2.3
Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: David Rushby (woodsplitter)
Assigned to: Martin v. Löwis (loewis)
Summary: Serious mem leak in socket module
Initial Comment:
There are memory leaks in Python 2.3's
socketmodule.c:getsockaddrarg function.
In the AF_INET clause of that function's switch, the
PyArg_ParseTuple format was changed from
"si:getsockaddrarg" in 2.2 to "eti:getsockaddrarg" in
2.3; in the AF_INET6 clause, the format was changed
from "si|ii" in 2.2 to "eti|ii" in 2.3.
The memory leak occurs because the "s" extractor did
not allocate any memory that needed to be manually
freed, whereas "et" does, yet no provision was added to
free the newly allocated memory.
Looks like this bug was introduced in CVS revision 1.259:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/python/python/dist/src/Modules/socketmodule.c.diff?r1=1.258&r2=1.259
I've attached a test program that demonstrates the
leak, plus a patch to socketmodule.c in unified diff
format.
To me, this leak seems serious because it affects
virtually every Python program that uses the socket
module (getsockaddrarg is called by the socket.socket
methods bind, connect, connect_ex, and sendto).
----------------------------------------------------------------------
Comment By: iscorinne (iscorinne)
Date: 2003-10-15 07:15
Message:
Logged In: YES
user_id=887306
hätten Sie halt mal gleich mich gefragt...
iscorinne
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2003-08-07 11:57
Message:
Logged In: YES
user_id=21627
Thanks for the report. I have applied a similar patch, in
socketmodule.c 1.273 and 1.271.6.2, NEWS 1.831.4.9.
----------------------------------------------------------------------
Comment By: Raymond Hettinger (rhettinger)
Date: 2003-08-06 05:56
Message:
Logged In: YES
user_id=80475
This was Martin's change (adding IDNA support).
Assigning to him to approve your patch.
----------------------------------------------------------------------
Comment By: Gottfried Stauffenberg (gottfried)
Date: 2003-08-05 20:35
Message:
Logged In: YES
user_id=838410
Since I have installed Python 2.3 Final (on Windows XP
Professional) I have got a serious problem in my data
uploading scripts to a SAP 7.4 Database on a different server.
Python crashes with no traceback available and Windows
notifies me of an serious program crash. The amount of data
being send before the crash is variable, it can be anything
between 100KB and 508KB of SQL INSERT statements
(according to my application log file). I am not sure if the
memory leak causes the program to crash, however this
might be a possible explanation
There had been no problems in 2.2.3. with about 300 MB of
sql statements.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=783312&group_id=5470
More information about the Python-bugs-list
mailing list