[ python-Bugs-1429585 ] segfault in FreeBSD

2006-02-11 Thread SourceForge.net
Bugs item #1429585, was opened at 2006-02-11 11:16
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1429585group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Threads
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: aix-d (aix-d)
Assigned to: Nobody/Anonymous (nobody)
Summary: segfault in FreeBSD

Initial Comment:
Dear developers,

My program has many TCP connections (~30 per second),
MySQL connections (~100 per second) and threads (~280).
It works long time and receives this segmentation fault:

exited on signal 11 (core dumped)

=== GDB OUTPUT
=
Program received signal SIGSEGV, Segmentation fault.
0x283199e8 in ?? () from
/usr/local/lib/python2.4/lib-dynload/_socket.so
(gdb) backtrace
#0  0x283199e8 in ?? () from
/usr/local/lib/python2.4/lib-dynload/_socket.so
#1  0x2831b3d5 in internal_connect ()
   from /usr/local/lib/python2.4/lib-dynload/_socket.so
#2  0x2831b440 in sock_connect ()
   from /usr/local/lib/python2.4/lib-dynload/_socket.so
#3  0x0805a828 in PyObject_Call ()
#4  0x080a01dd in PyEval_EvalFrame ()
#5  0x080a294f in PyEval_EvalCodeEx ()
#6  0x080a138b in PyEval_EvalFrame ()
#7  0x080a212d in PyEval_EvalFrame ()
#8  0x080a212d in PyEval_EvalFrame ()
#9  0x080a212d in PyEval_EvalFrame ()
#10 0x080a212d in PyEval_EvalFrame ()
#11 0x080a212d in PyEval_EvalFrame ()
#12 0x080a294f in PyEval_EvalCodeEx ()
#13 0x080a138b in PyEval_EvalFrame ()
#14 0x080a212d in PyEval_EvalFrame ()
#15 0x080a294f in PyEval_EvalCodeEx ()
#16 0x080da027 in PyFunction_SetClosure ()
#17 0x0805a828 in PyObject_Call ()
#18 0x080a01dd in PyEval_EvalFrame ()
#19 0x080a294f in PyEval_EvalCodeEx ()
#20 0x080a138b in PyEval_EvalFrame ()
#21 0x080a294f in PyEval_EvalCodeEx ()
#22 0x080a138b in PyEval_EvalFrame ()
#23 0x080a294f in PyEval_EvalCodeEx ()
#24 0x080a138b in PyEval_EvalFrame ()
#25 0x080a294f in PyEval_EvalCodeEx ()
#26 0x080a138b in PyEval_EvalFrame ()
#27 0x080a294f in PyEval_EvalCodeEx ()
#28 0x080a138b in PyEval_EvalFrame ()
#29 0x080a294f in PyEval_EvalCodeEx ()
#30 0x080a138b in PyEval_EvalFrame ()
#31 0x080a212d in PyEval_EvalFrame ()
#32 0x080a294f in PyEval_EvalCodeEx ()
#33 0x080da027 in PyFunction_SetClosure ()
#34 0x0805a828 in PyObject_Call ()
#35 0x080601e9 in PyMethod_New ()
#36 0x0805a828 in PyObject_Call ()
#37 0x0809cd31 in PyEval_CallObjectWithKeywords ()
#38 0x080c21a5 in _PyObject_GC_Del ()
#39 0x2821e0cc in pthread_create () from
/usr/lib/libpthread.so.2
#40 0x282db757 in _ctx_start () from /lib/libc.so.6
(gdb)
 END OF GDB OUTPUT
=

Imported modules: socket, atexit, time, pickle, os,
random, traceback, MySQLdb, re, urllib, urllib2, threading

Python version: 2.4.2

Operating system: FreeBSD 6.0-STABLE

Can you help with debugging?

Best regards, Alexander.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1429585group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1429783 ] urllib.py: AttributeError on BadStatusLine

2006-02-11 Thread SourceForge.net
Bugs item #1429783, was opened at 2006-02-11 19:15
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1429783group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Robert Kiendl (kxroberto)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib.py: AttributeError on BadStatusLine

Initial Comment:
PythonWin 2.3.5 (#62, Feb  8 2005, 16:23:02) [MSC
v.1200 32 bit (Intel)] on win32.


in httplib errcode -1 
file=self._conn.sock.makefile('rb', 0) is returned on
Badstatusline:

except BadStatusLine, e:
### hmm. if getresponse() ever closes the
socket on a bad request,
### then we are going to have problems with
self.sock

### should we keep this behavior? do people
use it?
# keep the socket open (as a file), and
return it
self.file = self._conn.sock.makefile('rb', 0)

# close our socket -- we want to restart
after any protocol error
self.close()

self.headers = None
return -1, e.line, None



fp = h.getfile()

delivers None in urllib.URLopener.open_http

and this is traceback leading to an AttributeError 


Traceback (most recent call last):

  File interactive input, line 1, in ?
  File C:\Python23\lib\urllib.py, line 181, in open
return getattr(self, name)(url)
  File C:\Python23\lib\urllib.py, line 306, in open_http
return self.http_error(url, fp, errcode, errmsg,
headers)
  File C:\Python23\lib\urllib.py, line 319, in http_error
result = method(url, fp, errcode, errmsg, headers)
  File C:\Python23\lib\urllib.py, line 584, in
http_error_301
return self.http_error_302(url, fp, errcode,
errmsg, headers, data)
  File C:\Python23\lib\urllib.py, line 565, in
http_error_302
data)
  File C:\Python23\lib\urllib.py, line 580, in
redirect_internal
return self.open(newurl)
  File C:\Python23\lib\urllib.py, line 181, in open
return getattr(self, name)(url)
  File C:\Python23\lib\urllib.py, line 306, in open_http
return self.http_error(url, fp, errcode, errmsg,
headers)
  File C:\Python23\lib\urllib.py, line 323, in http_error
return self.http_error_default(url, fp, errcode,
errmsg, headers)
  File C:\Python23\lib\urllib.py, line 327, in
http_error_default
void = fp.read()
AttributeError: 'NoneType' object has no attribute 'read'



As I get this error rarely I cannot reproduce exactly how

self._conn.sock.makefile('rb', 0)

delivers None in that case.



--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1429783group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1424152 ] urllib: HTTPS over (Squid) Proxy fails

2006-02-11 Thread SourceForge.net
Bugs item #1424152, was opened at 2006-02-04 18:50
Message generated for change (Comment added) made by kxroberto
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1424152group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Robert Kiendl (kxroberto)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib: HTTPS over (Squid) Proxy fails

Initial Comment:
py2.4.2/win32

The proxy mechanism of python fails on https and does
work completely wrong (not using the CONNECT scheme).

(after urlopen some minute(s) freeze then EOF error)

Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310
32 bit (Intel)] on win32
Type help, copyright, credits or license for
more information.
 import urllib
 urllib.getproxies()
{'ftp': 'ftp://vserver:3128', 'http':
'http://vserver:3128', 'gopher': 'gopher:/
/vserver:3128', 'https': 'https://vserver:3128'}
 urllib.urlopen('https://www.elster.de')
Traceback (most recent call last):
  File stdin, line 1, in ?
  File C:\Python24\lib\urllib.py, line 77, in urlopen
return opener.open(url)
  File C:\Python24\lib\urllib.py, line 185, in open
return getattr(self, name)(url)
  File C:\Python24\lib\urllib.py, line 386, in open_https
h.endheaders()
  File C:\Python24\lib\httplib.py, line 795, in
endheaders
self._send_output()
  File C:\Python24\lib\httplib.py, line 676, in
_send_output
self.send(msg)
  File C:\Python24\lib\httplib.py, line 643, in send
self.connect()
  File C:\Python24\lib\httplib.py, line 1071, in connect
ssl = socket.ssl(sock, self.key_file, self.cert_file)
  File C:\Python24\lib\socket.py, line 74, in ssl
return _realssl(sock, keyfile, certfile)
IOError: [Errno socket error] (8, 'EOF occurred in
violation of protocol')




no CONNECT even appears in the squid proxy access log.

Robert
 

--

Comment By: Robert Kiendl (kxroberto)
Date: 2006-02-11 19:28

Message:
Logged In: YES 
user_id=972995

Meanwhile I wrote my own CONNECT quick hack.   As indeed
this hack works correct for all proxied environments tested
up to now (30) I wonder how open_https  (in urllib and
urllib2) ever in the past managed to come through a proxy,
because there is some differentiation in open_https for the
case, that there is a proxy!? Who has written that
if..else's? Are there proxies which really do
SSL-handshaking directly and make an extra connection to the
target server? I guess that would even make certificate
handling very strange... I cannot immagine and never saw
one. But maybe such proxies exist. I am not a real expert
for such networking questions, but I guess CONNECT is widely
used and in my own proxies I can see in the log file, that
all common browsers use a HTTP CONNECT request for https
proxying. CONNECT should at least be implemented as an
option in urllibX

Robert


--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1424152group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-876637 ] Random stack corruption from socketmodule.c

2006-02-11 Thread SourceForge.net
Bugs item #876637, was opened at 2004-01-13 22:41
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=876637group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Mike Pall (mikesfpy)
Assigned to: Neal Norwitz (nnorwitz)
Summary: Random stack corruption from socketmodule.c 

Initial Comment:
THE PROBLEM:

The implementation of the socket_object.settimeout() method
(socketmodule.c, function internal_select()) uses the select() system
call with an unbounded file descriptor number. This will cause random
stack corruption if fd=FD_SETSIZE.

This took me ages to track down! It happened with a massively 
multithreaded
and massively connection-swamped network server. Basically most of 
the
descriptors did not use that routine (because they were either pure 
blocking
or pure non-blocking). But one module used settimeout() and with a little
bit of luck got an fd=FD_SETSIZE and with even more luck corrupted 
the
stack and took down the whole server process.

Demonstration script appended.

THE SOLUTION:

The solution is to use poll() and to favour poll() even if select()
is available on a platform. The current trend in modern OS+libc
combinations is to emulate select() in libc and call kernel-level poll()
anyway. And this emulation is costly (both for the caller and for libc).

Not so the other way round (only some systems of historical interest
do that BTW), so we definitely want to use poll() if it's available
(even if it's an emulation).

And if select() is your only choice, then check for FD_SETSIZE before
using the FD_SET macro (and raise some strange exception if that fails).

[
I should note that using SO_RCVTIMEO and SO_SNDTIMEO would be a lot 
more
efficient (kernel-wise at least). Unfortunately they are not universally
available (though defined by most system header files). But a simple
runtime test with a fallback to poll()/select() would do.
]

A PATCH, A PATCH?

Well, the check for FD_SETSIZE is left as an exercise for the reader. :-)
Don't forget to merge this with the stray select() way down by adding 
a return value to internal_select().

But yes, I can do a 'real' patch with poll() [and even one with the
SO_RCVTIMEO trick if you are adventurous]. But, I can't test it with
dozens of platforms, various include files, compilers and so on.

So, dear Python core developers: Please discuss this and tell me,
if you want a patch, then you'll get one ASAP.

Thank you for your time!


--

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-02-11 22:19

Message:
Logged In: YES 
user_id=33168

Martin has fixed my Window's breakage by only checking for
selectability on non-Windows platforms.

--

Comment By: Scott Dial (geekmug)
Date: 2006-02-09 21:12

Message:
Logged In: YES 
user_id=383208

The patch that has been applied has no relevance to Windows
and should not be used when compiling for Windows. The use
of an internal counter to assign descriptors to the fd_set
array avoids the problem noted here so there is no such bug
on Windows. Futhermore, as Arek notes, Windows creates
descriptor numbers with no bound.

--

Comment By: Arek Korbik (arkadini)
Date: 2006-02-09 07:20

Message:
Logged In: YES 
user_id=1346917

Unfortunately r42253 breaks things on win32 (at least on my
machine).

By default FD_SETSIZE is 64 (winsock.h, winsock2.h). Even if
the check from select module WAS included, that would end up
in 512. Most of the time, first socket I create after
starting python gets a fd  900.

What is a reasonable value for FD_SETSIZE then? 1024?
Compared to the default value of 64 doesn't look that
reasonable, though...

Are there plans to elaborate on the last fix?

--

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-02-06 23:18

Message:
Logged In: YES 
user_id=33168

Thanks!

Committed revision 42253.
Committed revision 42254. (2.4)


--

Comment By: Troels Walsted Hansen (troels)
Date: 2004-06-10 04:15

Message:
Logged In: YES 
user_id=32863

I have created a patch to make socketmodule use poll() when
available. See http://python.org/sf/970288

(I'm not allowed to attach patches to this bug item.)


--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=876637group_id=5470
___
Python-bugs-list mailing list 

[ python-Bugs-1427552 ] tarfile.open bug / corrupt data

2006-02-11 Thread SourceForge.net
Bugs item #1427552, was opened at 2006-02-08 06:13
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1427552group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.4
Status: Open
Resolution: None
Priority: 7
Submitted By: Chris86 (chris86)
Assigned to: Nobody/Anonymous (nobody)
Summary: tarfile.open bug / corrupt data

Initial Comment:
Hi!

I want to create a bz2 compressed tar file.
Here is my code:
full=/home/test/test.sql
tar = tarfile.open(test.tar.bz2, w:bz2)
tarinfo = tar.gettarinfo(full,blubb.sql)
tar.addfile(tarinfo,file(full))
tar.close()

i think this should work, but the sql file is corrupt:
- the created sql file in the compressed tar has only
4745 Lines, the original file has 4753


Regards,
Chris

--

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-02-11 22:21

Message:
Logged In: YES 
user_id=33168

Chris can you attach your sql file (or a small test case) so
we can reproduce the problem?

--

Comment By: Lars Gustäbel (gustaebel)
Date: 2006-02-08 07:13

Message:
Logged In: YES 
user_id=642936

Just to identify whether this is a tarfile or bz2 module
related issue:
- Do you have the same problem without compression or with
gzip compression?
- Have you tried compressing your sql file directly with the
bz2 module? 

--

Comment By: Chris86 (chris86)
Date: 2006-02-08 06:17

Message:
Logged In: YES 
user_id=1133569

same error with Python 2.3.5 (#2, Aug 30 2005, 15:50:26)
[GCC 4.0.2 20050821 (prerelease) (Debian 4.0.1-6)] on linux2


--

Comment By: Chris86 (chris86)
Date: 2006-02-08 06:15

Message:
Logged In: YES 
user_id=1133569

I'm using Python 2.4.2 (#2, Nov 20 2005, 17:04:48)
[GCC 4.0.3 2005 (prerelease) (Debian 4.0.2-4)] on linux2

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1427552group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1429585 ] segfault in FreeBSD

2006-02-11 Thread SourceForge.net
Bugs item #1429585, was opened at 2006-02-11 00:16
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1429585group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Threads
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: aix-d (aix-d)
Assigned to: Nobody/Anonymous (nobody)
Summary: segfault in FreeBSD

Initial Comment:
Dear developers,

My program has many TCP connections (~30 per second),
MySQL connections (~100 per second) and threads (~280).
It works long time and receives this segmentation fault:

exited on signal 11 (core dumped)

=== GDB OUTPUT
=
Program received signal SIGSEGV, Segmentation fault.
0x283199e8 in ?? () from
/usr/local/lib/python2.4/lib-dynload/_socket.so
(gdb) backtrace
#0  0x283199e8 in ?? () from
/usr/local/lib/python2.4/lib-dynload/_socket.so
#1  0x2831b3d5 in internal_connect ()
   from /usr/local/lib/python2.4/lib-dynload/_socket.so
#2  0x2831b440 in sock_connect ()
   from /usr/local/lib/python2.4/lib-dynload/_socket.so
#3  0x0805a828 in PyObject_Call ()
#4  0x080a01dd in PyEval_EvalFrame ()
#5  0x080a294f in PyEval_EvalCodeEx ()
#6  0x080a138b in PyEval_EvalFrame ()
#7  0x080a212d in PyEval_EvalFrame ()
#8  0x080a212d in PyEval_EvalFrame ()
#9  0x080a212d in PyEval_EvalFrame ()
#10 0x080a212d in PyEval_EvalFrame ()
#11 0x080a212d in PyEval_EvalFrame ()
#12 0x080a294f in PyEval_EvalCodeEx ()
#13 0x080a138b in PyEval_EvalFrame ()
#14 0x080a212d in PyEval_EvalFrame ()
#15 0x080a294f in PyEval_EvalCodeEx ()
#16 0x080da027 in PyFunction_SetClosure ()
#17 0x0805a828 in PyObject_Call ()
#18 0x080a01dd in PyEval_EvalFrame ()
#19 0x080a294f in PyEval_EvalCodeEx ()
#20 0x080a138b in PyEval_EvalFrame ()
#21 0x080a294f in PyEval_EvalCodeEx ()
#22 0x080a138b in PyEval_EvalFrame ()
#23 0x080a294f in PyEval_EvalCodeEx ()
#24 0x080a138b in PyEval_EvalFrame ()
#25 0x080a294f in PyEval_EvalCodeEx ()
#26 0x080a138b in PyEval_EvalFrame ()
#27 0x080a294f in PyEval_EvalCodeEx ()
#28 0x080a138b in PyEval_EvalFrame ()
#29 0x080a294f in PyEval_EvalCodeEx ()
#30 0x080a138b in PyEval_EvalFrame ()
#31 0x080a212d in PyEval_EvalFrame ()
#32 0x080a294f in PyEval_EvalCodeEx ()
#33 0x080da027 in PyFunction_SetClosure ()
#34 0x0805a828 in PyObject_Call ()
#35 0x080601e9 in PyMethod_New ()
#36 0x0805a828 in PyObject_Call ()
#37 0x0809cd31 in PyEval_CallObjectWithKeywords ()
#38 0x080c21a5 in _PyObject_GC_Del ()
#39 0x2821e0cc in pthread_create () from
/usr/lib/libpthread.so.2
#40 0x282db757 in _ctx_start () from /lib/libc.so.6
(gdb)
 END OF GDB OUTPUT
=

Imported modules: socket, atexit, time, pickle, os,
random, traceback, MySQLdb, re, urllib, urllib2, threading

Python version: 2.4.2

Operating system: FreeBSD 6.0-STABLE

Can you help with debugging?

Best regards, Alexander.

--

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-02-11 22:54

Message:
Logged In: YES 
user_id=33168

Can you build python from source?  You can try checking out
the current 2.4 SVN.  This problem may have been fixed
recently.  I'm guessing that the socket descriptor value is
larger than FD_SETSIZE (probably 1k or 4k).  You also may
want to build python with debugging.

If that doesn't solve your problem, you will need to provide
more information about how to reproduce your problem.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1429585group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1429783 ] urllib.py: AttributeError on BadStatusLine

2006-02-11 Thread SourceForge.net
Bugs item #1429783, was opened at 2006-02-11 10:15
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1429783group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Robert Kiendl (kxroberto)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib.py: AttributeError on BadStatusLine

Initial Comment:
PythonWin 2.3.5 (#62, Feb  8 2005, 16:23:02) [MSC
v.1200 32 bit (Intel)] on win32.


in httplib errcode -1 
file=self._conn.sock.makefile('rb', 0) is returned on
Badstatusline:

except BadStatusLine, e:
### hmm. if getresponse() ever closes the
socket on a bad request,
### then we are going to have problems with
self.sock

### should we keep this behavior? do people
use it?
# keep the socket open (as a file), and
return it
self.file = self._conn.sock.makefile('rb', 0)

# close our socket -- we want to restart
after any protocol error
self.close()

self.headers = None
return -1, e.line, None



fp = h.getfile()

delivers None in urllib.URLopener.open_http

and this is traceback leading to an AttributeError 


Traceback (most recent call last):

  File interactive input, line 1, in ?
  File C:\Python23\lib\urllib.py, line 181, in open
return getattr(self, name)(url)
  File C:\Python23\lib\urllib.py, line 306, in open_http
return self.http_error(url, fp, errcode, errmsg,
headers)
  File C:\Python23\lib\urllib.py, line 319, in http_error
result = method(url, fp, errcode, errmsg, headers)
  File C:\Python23\lib\urllib.py, line 584, in
http_error_301
return self.http_error_302(url, fp, errcode,
errmsg, headers, data)
  File C:\Python23\lib\urllib.py, line 565, in
http_error_302
data)
  File C:\Python23\lib\urllib.py, line 580, in
redirect_internal
return self.open(newurl)
  File C:\Python23\lib\urllib.py, line 181, in open
return getattr(self, name)(url)
  File C:\Python23\lib\urllib.py, line 306, in open_http
return self.http_error(url, fp, errcode, errmsg,
headers)
  File C:\Python23\lib\urllib.py, line 323, in http_error
return self.http_error_default(url, fp, errcode,
errmsg, headers)
  File C:\Python23\lib\urllib.py, line 327, in
http_error_default
void = fp.read()
AttributeError: 'NoneType' object has no attribute 'read'



As I get this error rarely I cannot reproduce exactly how

self._conn.sock.makefile('rb', 0)

delivers None in that case.



--

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-02-11 22:55

Message:
Logged In: YES 
user_id=33168

This may be a duplicate of a bug submitted by Bram Cohen. 
It was a couple of years ago and I don't remember any other
details.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1429783group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1429783 ] urllib.py: AttributeError on BadStatusLine

2006-02-11 Thread SourceForge.net
Bugs item #1429783, was opened at 2006-02-11 10:15
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1429783group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Robert Kiendl (kxroberto)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib.py: AttributeError on BadStatusLine

Initial Comment:
PythonWin 2.3.5 (#62, Feb  8 2005, 16:23:02) [MSC
v.1200 32 bit (Intel)] on win32.


in httplib errcode -1 
file=self._conn.sock.makefile('rb', 0) is returned on
Badstatusline:

except BadStatusLine, e:
### hmm. if getresponse() ever closes the
socket on a bad request,
### then we are going to have problems with
self.sock

### should we keep this behavior? do people
use it?
# keep the socket open (as a file), and
return it
self.file = self._conn.sock.makefile('rb', 0)

# close our socket -- we want to restart
after any protocol error
self.close()

self.headers = None
return -1, e.line, None



fp = h.getfile()

delivers None in urllib.URLopener.open_http

and this is traceback leading to an AttributeError 


Traceback (most recent call last):

  File interactive input, line 1, in ?
  File C:\Python23\lib\urllib.py, line 181, in open
return getattr(self, name)(url)
  File C:\Python23\lib\urllib.py, line 306, in open_http
return self.http_error(url, fp, errcode, errmsg,
headers)
  File C:\Python23\lib\urllib.py, line 319, in http_error
result = method(url, fp, errcode, errmsg, headers)
  File C:\Python23\lib\urllib.py, line 584, in
http_error_301
return self.http_error_302(url, fp, errcode,
errmsg, headers, data)
  File C:\Python23\lib\urllib.py, line 565, in
http_error_302
data)
  File C:\Python23\lib\urllib.py, line 580, in
redirect_internal
return self.open(newurl)
  File C:\Python23\lib\urllib.py, line 181, in open
return getattr(self, name)(url)
  File C:\Python23\lib\urllib.py, line 306, in open_http
return self.http_error(url, fp, errcode, errmsg,
headers)
  File C:\Python23\lib\urllib.py, line 323, in http_error
return self.http_error_default(url, fp, errcode,
errmsg, headers)
  File C:\Python23\lib\urllib.py, line 327, in
http_error_default
void = fp.read()
AttributeError: 'NoneType' object has no attribute 'read'



As I get this error rarely I cannot reproduce exactly how

self._conn.sock.makefile('rb', 0)

delivers None in that case.



--

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-02-11 22:56

Message:
Logged In: YES 
user_id=33168

I should add that the other bug is still open.

--

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-02-11 22:55

Message:
Logged In: YES 
user_id=33168

This may be a duplicate of a bug submitted by Bram Cohen. 
It was a couple of years ago and I don't remember any other
details.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1429783group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com