[ python-Bugs-853507 ] socket.recv() raises MemoryError exception (WindowsXP ONLY)

SourceForge.net noreply at sourceforge.net
Wed Dec 3 20:16:44 EST 2003


Bugs item #853507, was opened at 2003-12-03 11:16
Message generated for change (Comment added) made by randyw
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=853507&group_id=5470

Category: Windows
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Randy Wiser (randyw)
Assigned to: Nobody/Anonymous (nobody)
Summary: socket.recv() raises MemoryError exception (WindowsXP ONLY)

Initial Comment:
Calling socket.recv(size) with size starting at 3000000 
and decreasing by approximately 1024 each time, quickly 
raises a MemoryError exception, although the process 
memory use does not exceed 30 Mbytes!  Verified on 
Python 2.1, 2.3 and 2.3.2 (under Windows XP 
Professional ONLY version 5.1.2600 hotfix KB824146 if it 
matters :-)

Cannot reproduce (test runs many iterations without fail) 
under Windows 2000 Professional or Server. To reproduce 
on XP, run attached files is separate shell windows:

c:\> python hostMemErrSrv.py
waiting for client on 3021
Connected by ('127.0.0.1', 1217)
. . . . . . . . . . . . . . . .

c:\> python hostMemErr.py
MemoryError, hit return to exit.
Traceback (most recent call last):
  File "hostMemErr.py", line 117, in ?
    main()
  File "hostMemErr.py", line 108, in main
    data = p.dataRecv(sz)
  File "hostMemErr.py", line 63, in dataRecv
    tmp = self.dataSocket.recv (nleft)
  File "<string>", line 1, in recv
MemoryError

----------------------------------------------------------------------

>Comment By: Randy Wiser (randyw)
Date: 2003-12-03 17:16

Message:
Logged In: YES 
user_id=215159

A quick test with Python 2.3 -i shows the following, so I'm 
guessing if at first WinXP claims no memory, try try again.  
Thanks for the quick response Tim. We'll try not to ask WinXP 
for 3 Mil. of memory unless we really need it.

python -i hostMemErr.py
MemoryError, hit return to exit.
Traceback (most recent call last):
  File "hostMemErr.py", line 117, in ?
    main()
  File "hostMemErr.py", line 108, in main
    data = p.dataRecv(sz)
  File "hostMemErr.py", line 63, in dataRecv
    tmp = self.dataSocket.recv (nleft)
MemoryError
>>> s= 'z' * 3000000
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
MemoryError
>>> s= 'z' * 3000000
>>> s= 'z' * 3000000
>>> s= 'z' * 3000000
>>> s= 'z' * 30000000
>>> ^Z

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2003-12-03 11:28

Message:
Logged In: YES 
user_id=31435

Python doesn't do anything differently across different flavors 
of Windows, so you're probably looking at a Microsoft bug, or 
an MS design limitation.  Note that doing recv() with an 
argument in the millions isn't a sane thing to do to begin with.

Unassigned from me, and reduced priority (I'm not going to do 
anything more on this; Randy, try writing equivalent code 
directly in C; if the same thing happens there, as appears 
likely, then your complaint should go to Microsoft).

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=853507&group_id=5470



More information about the Python-bugs-list mailing list