[issue46156] 3.9.9: python built-in SSL module unable to connect to an IIS server (104 Connection reset by peer), but pyopenssl works fine

2021-12-24 Thread lkraav


lkraav  added the comment:

> I need more information to diagnose the issue. Could you please provide:
> - your operating system and vendor/distribution

Gentoo, so rolling, but 20 years of maintenance experience.

> - your OpenSSL version (ssl.OPENSSL_VERSION)

$ python
Python 3.9.9 (main, Dec 21 2021, 17:21:49) 
[GCC 10.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
@>>> import ssl
@>>> print(ssl.OPENSSL_VERSION)
OpenSSL 1.1.1l  24 Aug 2021


> - how did you install Python (self-compiled, pyenv, system Python)?

System Python. On Gentoo, features configuration revolve around USE flags, but 
I don't have anything curious built with "gdbm ncurses readline sqlite ssl xml" 
being active:

$ eix dev-lang/python$
[U] dev-lang/python
 Available versions:  
 ...
 (3.9)  3.9.9^t{xpak}
 ...
   {berkdb bluetooth build examples gdbm hardened libedit lto +ncurses pgo 
+readline +sqlite +ssl test tk verify-sig wininst +xml ELIBC="uclibc"}
 Installed versions:  3.9.9(3.9)^t{xpak}(17:22:24 21.12.2021)(gdbm ncurses 
readline sqlite ssl xml -bluetooth -build -examples -hardened -lto -pgo -test 
-tk -verify-sig -wininst)
 Homepage:https://www.python.org/
 Description: An interpreted, interactive, object-oriented 
programming language


> - how did you install PyOpenSSL and cryptography?

Regular system package manager install

$ eix pyopenssl
[I] dev-python/pyopenssl
 Available versions:  20.0.1^t{xpak} {doc test PYTHON_TARGETS="pypy3 
python3_8 python3_9 python3_10"}
 Installed versions:  20.0.1^t{xpak}(11:43:07 03.06.2021)(-doc -test 
PYTHON_TARGETS="python3_9 -pypy3 -python3_8 -python3_10")
 Homepage:https://www.pyopenssl.org/ 
https://pypi.org/project/pyOpenSSL/ https://github.com/pyca/pyopenssl/
 Description: Python interface to the OpenSSL library

$ eix cryptography
[I] dev-python/cryptography
 Available versions:  3.4.7-r2^t{xpak} **36.0.0^t {debug test 
PYTHON_TARGETS="pypy3 python3_8 python3_9 python3_10"}
 Installed versions:  3.4.7-r2^t{xpak}(16:35:10 21.12.2021)(-test 
PYTHON_TARGETS="python3_9 -pypy3 -python3_8 -python3_10")
 Homepage:https://github.com/pyca/cryptography/ 
https://pypi.org/project/cryptography/
 Description: Library providing cryptographic recipes and primitives

> - the full output of: openssl s_client -connect webapi.remote:52100

$ openssl s_client -connect webapi.remote:52100 

  
CONNECTED(0003)
depth=0 CN = webapi.remote
verify error:num=18:self signed certificate
verify return:1
depth=0 CN = webapi.remote
verify return:1
---
Certificate chain
 0 s:CN = webapi.remote
   i:CN = webapi.remote
---
Server certificate
-BEGIN CERTIFICATE-

-END CERTIFICATE-
subject=CN = webapi.remote

issuer=CN = webapi.remote

---
No client certificate CA names sent
Peer signing digest: SHA1
Peer signature type: RSA
Server Temp Key: ECDH, P-256, 256 bits
---
SSL handshake has read 1254 bytes and written 502 bytes
Verification error: self signed certificate
---
New, TLSv1.2, Cipher is ECDHE-RSA-AES256-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol  : TLSv1.2
Cipher: ECDHE-RSA-AES256-SHA384
Session-ID: 2706127E5AA837E96D63F5DE532C53FAD1D5C034CBF3D305B7978E9636A0
Session-ID-ctx: 
Master-Key: 
FAE8DE30BF627E7F02F8B4AA856075675FAF3A92365A1E9E8041F799E29CE809749B35514065255C62F0D449405C02B8
PSK identity: None
PSK identity hint: None
SRP username: None
Start Time: 1640346190
Timeout   : 7200 (sec)
Verify return code: 18 (self signed certificate)
Extended master secret: yes
---
DONE

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46156] 3.9.9: python built-in SSL module unable to connect to an IIS server (104 Connection reset by peer), but pyopenssl works fine

2021-12-22 Thread Christian Heimes


Christian Heimes  added the comment:

I need more information to diagnose the issue. Could you please provide:

- your operating system and vendor/distribution
- your OpenSSL version (ssl.OPENSSL_VERSION)
- how did you install Python (self-compiled, pyenv, system Python)?
- how did you install PyOpenSSL and cryptography?
- the full output of: openssl s_client -connect webapi.remote:52100

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46156] 3.9.9: python built-in SSL module unable to connect to an IIS server (104 Connection reset by peer), but pyopenssl works fine

2021-12-22 Thread lkraav


New submission from lkraav :

Problems emerged when Requests phased out PyOpenSSL as their default backend 
https://github.com/psf/requests/blob/main/HISTORY.md#2240-2020-06-17

Suddenly my script wasn't able to connect to a remote server that it had been 
working with for years.

All connection attempts with Python built-in SSL module, with various 
certificate or TLS configurations tested, result in a blunt 
ConnectionResetError during `do_handshake()`

This leads me to believe Python SSL module is maybe incompatible [with some IIS 
thing] in some perhaps fixable way, because going with PyOpenSSL backend via 
`urllib3.contrib.pyopenssl.inject_into_urllib3()`

I can provide the real server name in a private email if any maintainers is 
interested in doing a debug run in some more thorough way that I'm unable to, 
let me know.

Example test:

```
$ ipython
Python 3.9.9 (main, Dec 21 2021, 17:21:49) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.29.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import ssl

In [2]: context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)

In [3]: import socket

In [4]: context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT, 
verify_mode=ssl.CERT_NONE)

In [5]: conn = context.wrap_socket(socket.socket(socket.AF_INET), 
server_hostname="webapi.remote")

In [6]: conn.connect(("webapi.remote", 52100))
---
ConnectionResetError  Traceback (most recent call last)
 in 
> 1 conn.connect(("webapi.remote", 52100))

/usr/lib/python3.9/ssl.py in connect(self, addr)
   1340 """Connects to remote ADDR, and then wraps the connection in
   1341 an SSL channel."""
-> 1342 self._real_connect(addr, False)
   1343 
   1344 def connect_ex(self, addr):

/usr/lib/python3.9/ssl.py in _real_connect(self, addr, connect_ex)
   1331 self._connected = True
   1332 if self.do_handshake_on_connect:
-> 1333 self.do_handshake()
   1334 return rc
   1335 except (OSError, ValueError):

/usr/lib/python3.9/ssl.py in do_handshake(self, block)
   1307 if timeout == 0.0 and block:
   1308 self.settimeout(None)
-> 1309 self._sslobj.do_handshake()
   1310 finally:
   1311     self.settimeout(timeout)

ConnectionResetError: [Errno 104] Connection reset by peer
```

--
assignee: christian.heimes
components: SSL
messages: 409050
nosy: christian.heimes, lkraav
priority: normal
severity: normal
status: open
title: 3.9.9: python built-in SSL module unable to connect to an IIS server 
(104 Connection reset by peer), but pyopenssl works fine
type: behavior
versions: Python 3.9

___
Python tracker 
<https://bugs.python.org/issue46156>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28968] xml rpc server fails with connection reset by peer error no 104

2021-04-26 Thread Irit Katriel


Irit Katriel  added the comment:

2.7 is no longer maintained. Please create a new issue with full reproduction 
information if you are still having this problem in 3.8+.

--
nosy: +iritkatriel
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30315] test_ftplib.TestTLS_FTPClass: "[Errno 54] Connection reset by peer" on "AMD64 FreeBSD CURRENT Debug 3.x" buildbot

2017-07-04 Thread STINNER Victor

STINNER Victor added the comment:

This issue seems like a duplicate of bpo-30319. While I'm not 100% confident, 
I'm quite sure that ignoring ECONNRESET in socket.close() should help ;-)

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Change socket.close() to ignore ECONNRESET

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30543] test_timeout fails on AMD64 FreeBSD CURRENT Debug 3.x: ConnectionResetError: [Errno 54] Connection reset by peer

2017-07-04 Thread STINNER Victor

Changes by STINNER Victor :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Change socket.close() to ignore ECONNRESET

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30319] ConnectionResetError: [Errno 54] Connection reset by peer in socket.close on FreeBSD, Py 3.6

2017-07-03 Thread STINNER Victor

Changes by STINNER Victor :


--
versions: +Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30319] ConnectionResetError: [Errno 54] Connection reset by peer in socket.close on FreeBSD, Py 3.6

2017-07-03 Thread STINNER Victor

STINNER Victor added the comment:

tl; dr I agree to ignore ECONNRESET-like errors on socket.shutdown() and 
sock.close().

I'm not sure that I understand *exactly* the problem here. In which case 
closing a socket fails with ECONNRESET? Can it mean that the last write() was 
buffered and failed?

If socket.send() is blocking, I expect that send() gets the ECONNRESET error.

If socket.send() is non-blocking, the application has to be very carefully 
written to handle many kinds of errors.

>From a high lever point of view, I don't think that ECONNRESET is interested. 
>I expect that a protocol at the application level doesn't rely on ECONNRESET, 
>but a command like "QUIT". No?

For a file on disk, it's different, since write() is always buffered and 
close() has to flush pending write on disk.

For a network protocol, loosing the connection, loosing data, etc. is something 
"normal", not something execptional. That's why there are application-level 
commands to close cleanly a connection.

Ok, now for SSL sockets... Is it also ok to ignore ECONNRESET on sock.close() 
for an SSL socket?

--

ECONNRESET can occur on sock.close(), but not only: see bpo-30329, shutdown() 
fails can ENOTCONN on UNIX or WSAEINVAL on Windows. I modified poplib and 
imaplib recently to handle WSAEINVAL:

commit 83a2c2879839da2e10037f5e4af1bd1dafbf1a52
Author: Victor Stinner 
Date:   Mon May 15 17:33:45 2017 +0200

bpo-30329: Catch Windows error 10022 on shutdown() (#1538)

Catch the Windows socket WSAEINVAL error (code 10022) in imaplib and
poplib on shutdown(SHUT_RDWR): An invalid operation was attempted

This error occurs sometimes on SSL connections.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30319] ConnectionResetError: [Errno 54] Connection reset by peer in socket.close on FreeBSD, Py 3.6

2017-07-03 Thread Antoine Pitrou

Antoine Pitrou added the comment:

None of "27784,30106,30315,30328,30391,30652,30543" are dependencies of this 
issue.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30319] ConnectionResetError: [Errno 54] Connection reset by peer in socket.close on FreeBSD, Py 3.6

2017-07-03 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> 2. Ignore ECONNRESET in “socket.close” (backwards compatible, could use 
> “os.close” if you really want to check for ECONNRESET)

+1 from me.

--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30319] ConnectionResetError: [Errno 54] Connection reset by peer in socket.close on FreeBSD, Py 3.6

2017-07-03 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Please, let's not use the "dependencies" field for issues which are not actual 
dependencies.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30319] ConnectionResetError: [Errno 54] Connection reset by peer in socket.close on FreeBSD, Py 3.6

2017-06-30 Thread Martin Panter

Martin Panter added the comment:

I think fixing all affected calls to socket.close in the world (option 3) would 
be too much. I just added two new reports (Issue 30652 and Issue 30391) as 
dependencies. These are about testing socketserver.TCPServer. As an example, to 
fix the socket.close call there, I think the change would look like

class TCPServer:
def close_request(self, request):
try:
request.close()
except ConnectionError:
# Suppress asynchronous errors such as ECONNRESET on Free BSD
pass

Instead of that change all over the place, I am thinking option 2 would be 
safest. In Modules/socketmodule.c, something like

sock_close(PySocketSockObject *s)
{
Py_BEGIN_ALLOW_THREADS
res = SOCKETCLOSE(fd);
Py_END_ALLOW_THREADS
/* ECONNRESET can occur on Free BSD */
if (res < 0 && errno != ECONNRESET) {
return s->errorhandler();
}
}

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30319] ConnectionResetError: [Errno 54] Connection reset by peer in socket.close on FreeBSD, Py 3.6

2017-06-30 Thread Martin Panter

Changes by Martin Panter :


--
dependencies: +test_threading_handled() of test_socketserver hangs randomly on 
AMD64 FreeBSD 10.x Shared 3.6, test_threading_not_handled() of 
test_socketserver hangs randomly on AMD64 FreeBSD 10.x Shared 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30543] test_timeout fails on AMD64 FreeBSD CURRENT Debug 3.x: ConnectionResetError: [Errno 54] Connection reset by peer

2017-06-23 Thread STINNER Victor

STINNER Victor added the comment:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%20CURRENT%20Debug%203.6/builds/266/steps/test/logs/stdio

==
ERROR: testSend (test.test_timeout.TCPTimeoutTestCase)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/test_timeout.py",
 line 151, in tearDown
self.sock.close()
  File 
"/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/socket.py", line 
417, in close
self._real_close()
  File 
"/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/socket.py", line 
411, in _real_close
_ss.close(self)
ConnectionResetError: [Errno 54] Connection reset by peer

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30543>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30319] ConnectionResetError: [Errno 54] Connection reset by peer in socket.close on FreeBSD, Py 3.6

2017-06-06 Thread STINNER Victor

STINNER Victor added the comment:

Before discussing revert, I would like experimenting fixing calls to
sock.close(). How much changes do we need to ignore exeptions on
sock.close()?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30315] test_ftplib.TestTLS_FTPClass: "[Errno 54] Connection reset by peer" on "AMD64 FreeBSD CURRENT Debug 3.x" buildbot

2017-06-03 Thread Martin Panter

Martin Panter added the comment:

See  about the “socket.close” 
exception, which should only affect 3.6+. But the 2.7 “recv” exception is a bit 
different.

--
nosy: +martin.panter

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30319] ConnectionResetError: [Errno 54] Connection reset by peer in socket.close on FreeBSD, Py 3.6

2017-06-03 Thread Martin Panter

Martin Panter added the comment:

Making this an index of related reports:

Issue 30319: test_imap
Issue 30315: test_ftplib
Issue 30543: test_timeout
Issue 30328: test_ssl
Issue 27784: test_asyncore.TestAPI_UseIPv6Select.test_handle_accept, 
test_socketserver
Issue 30106: test_asyncore.TestAPI_UseIPv6Poll.test_handle_write

These all look like a side effect of my change to raise an error from the OS as 
an exception when closing a socket, Issue 26685. Only 3.6+ is affected. 
According to <https://www.freebsd.org/cgi/man.cgi?close%282%29>, ECONNRESET 
means “The underlying object was a stream socket that was shut down by the peer 
before all pending data was delivered”.

It seems this is specific to Free BSD. See bug report about Posix compliance: 
<https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=159179>. According to 
<https://forums.zeroc.com/discussion/5569/patch-to-network-cpp-for-freebsd-for-econnreset-on-close-2-problem>
 this started in Free BSD 6.3 in 2006.

I suppose the options are:

1. Completely revert Issue 26685 and ignore all “socket.close” errors (my least 
preferred option)
2. Ignore ECONNRESET in “socket.close” (backwards compatible, could use 
“os.close” if you really want to check for ECONNRESET)
3. Ignore ECONNRESET in the various higher-level libraries
4. Adjust the tests to ignore the error or otherwise avoid the problem

--
dependencies: +Random failure of test_TCPServer() of 
test.test_socketserver.SocketServerTest and test_handle_accept() of 
test.test_asyncore.TestAPI_UseIPv6Select on FreeBSD buildbots, test_asyncore: 
test_handle_write() fails in tearDown(), test_ftplib.TestTLS_FTPClass: "[Errno 
54] Connection reset by peer" on "AMD64 FreeBSD CURRENT Debug 3.x" buildbot, 
test_ssl.test_connect_with_context(): ConnectionResetError on AMD64 FreeBSD 9.x 
3.6, test_timeout fails on AMD64 FreeBSD CURRENT Debug 3.x: 
ConnectionResetError: [Errno 54] Connection reset by peer
keywords: +3.6regression
nosy: +martin.panter
title: test_invalid_authentication()  of test_imaplib: ConnectionResetError: 
[Errno 54] Connection reset by peer in shutdown() on AMD64 FreeBSD 9.x 3.6 -> 
ConnectionResetError: [Errno 54] Connection reset by peer in socket.close on 
FreeBSD, Py 3.6
type:  -> behavior

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30319>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30543] test_timeout fails on AMD64 FreeBSD CURRENT Debug 3.x: ConnectionResetError: [Errno 54] Connection reset by peer

2017-06-01 Thread STINNER Victor

Changes by STINNER Victor :


--
keywords: +buildbot

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30543] test_timeout fails on AMD64 FreeBSD CURRENT Debug 3.x: ConnectionResetError: [Errno 54] Connection reset by peer

2017-06-01 Thread STINNER Victor

New submission from STINNER Victor:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%20CURRENT%20Debug%203.x/builds/350/steps/test/logs/stdio

testAcceptTimeout (test.test_timeout.TCPTimeoutTestCase) ... ok
testConnectTimeout (test.test_timeout.TCPTimeoutTestCase) ... skipped "Resource 
'blackhole.snakebite.net' is not available"
testRecvTimeout (test.test_timeout.TCPTimeoutTestCase) ... ok
testSend (test.test_timeout.TCPTimeoutTestCase) ... ERROR
testSendall (test.test_timeout.TCPTimeoutTestCase) ... ok
testSendto (test.test_timeout.TCPTimeoutTestCase) ... ERROR
testRecvfromTimeout (test.test_timeout.UDPTimeoutTestCase) ... test 
test_timeout failed
ok

==
ERROR: testSend (test.test_timeout.TCPTimeoutTestCase)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_timeout.py",
 line 151, in tearDown
self.sock.close()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/socket.py", line 
417, in close
self._real_close()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/socket.py", line 
411, in _real_close
_ss.close(self)
ConnectionResetError: [Errno 54] Connection reset by peer

==
ERROR: testSendto (test.test_timeout.TCPTimeoutTestCase)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_timeout.py",
 line 151, in tearDown
self.sock.close()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/socket.py", line 
417, in close
self._real_close()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/socket.py", line 
411, in _real_close
    _ss.close(self)
ConnectionResetError: [Errno 54] Connection reset by peer

--
Ran 14 tests in 10.084s

FAILED (errors=2, skipped=1)
1 test failed again:
test_timeout

Total duration: 17 min 14 sec
Tests result: FAILURE

--
components: Tests
messages: 294971
nosy: haypo
priority: normal
severity: normal
status: open
title: test_timeout fails on AMD64 FreeBSD CURRENT Debug 3.x: 
ConnectionResetError: [Errno 54] Connection reset by peer
versions: Python 3.7

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30543>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30315] test_ftplib.TestTLS_FTPClass: "[Errno 54] Connection reset by peer" on "AMD64 FreeBSD CURRENT Debug 3.x" buildbot

2017-05-12 Thread STINNER Victor

STINNER Victor added the comment:

Another error on AMD64 FreeBSD CURRENT Non-Debug 2.7:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%20CURRENT%20Non-Debug%202.7/builds/92/steps/test/logs/stdio

0:04:23 [171/402/1] test_urllib2net failed
test test_urllib2net failed -- Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/test/test_urllib2net.py",
 line 166, in test_fileno
res = opener.open(req)
  File 
"/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/urllib2.py",
 line 429, in open
response = self._open(req, data)
  File 
"/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/urllib2.py",
 line 447, in _open
'_open', req)
  File 
"/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/urllib2.py",
 line 407, in _call_chain
result = func(*args)
  File 
"/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/urllib2.py",
 line 1228, in http_open
return self.do_open(httplib.HTTPConnection, req)
  File 
"/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/urllib2.py",
 line 1201, in do_open
r = h.getresponse(buffering=True)
  File 
"/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/httplib.py",
 line 1121, in getresponse
response.begin()
  File 
"/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/httplib.py",
 line 438, in begin
version, status, reason = self._read_status()
  File 
"/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/httplib.py",
 line 394, in _read_status
line = self.fp.readline(_MAXLINE + 1)
  File 
"/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/socket.py",
 line 480, in readline
data = self._sock.recv(self._rbufsize)
error: [Errno 54] Connection reset by peer

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30315>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30319] test_invalid_authentication() of test_imaplib: ConnectionResetError: [Errno 54] Connection reset by peer in shutdown() on AMD64 FreeBSD 9.x 3.6

2017-05-10 Thread STINNER Victor

Changes by STINNER Victor <victor.stin...@gmail.com>:


--
title: test_invalid_authentication()  of test_imaplib: ConnectionResetError: 
[Errno 54] Connection reset by peer on AMD64 FreeBSD 9.x 3.6 -> 
test_invalid_authentication()  of test_imaplib: ConnectionResetError: [Errno 
54] Connection reset by peer in shutdown() on AMD64 FreeBSD 9.x 3.6

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30319>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30319] test_invalid_authentication() of test_imaplib: ConnectionResetError: [Errno 54] Connection reset by peer on AMD64 FreeBSD 9.x 3.6

2017-05-10 Thread STINNER Victor

STINNER Victor added the comment:

@Our SSL experts: any idea why sock.close() fails with "ConnectionResetError: 
[Errno 54] Connection reset by peer" in imaplib? Is that a new error? Should 
imaplib catch ConnectionResetError on sock.close()?

By the way, see also bpo-30329: I proposed a patch to catch the Windows socket 
error 10022 on shutdown() for poplib and imaplib SSL connections. No idea why 
this error only occurs on SSL connections.

--
nosy: +alex, christian.heimes, dstufft, janssen

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30319>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30315] test_ftplib.TestTLS_FTPClass: "[Errno 54] Connection reset by peer" on "AMD64 FreeBSD CURRENT Debug 3.x" buildbot

2017-05-10 Thread STINNER Victor

STINNER Victor added the comment:

See also bpo-30328 (test_ssl) and bpo-30319 (test_imaplib).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30319] test_invalid_authentication() of test_imaplib: ConnectionResetError: [Errno 54] Connection reset by peer on AMD64 FreeBSD 9.x 3.6

2017-05-10 Thread STINNER Victor

STINNER Victor added the comment:

See also bpo-30328 (test_ssl) and bpo-30315 (test_ftplib).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30319] test_invalid_authentication() of test_imaplib: ConnectionResetError: [Errno 54] Connection reset by peer on AMD64 FreeBSD 9.x 3.6

2017-05-10 Thread STINNER Victor

Changes by STINNER Victor <victor.stin...@gmail.com>:


--
title: test_invalid_authentication()  of test_imaplib: random failure on AMD64 
FreeBSD 9.x 3.6 -> test_invalid_authentication()  of test_imaplib: 
ConnectionResetError: [Errno 54] Connection reset by peer on AMD64 FreeBSD 9.x 
3.6

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30319>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30315] test_ftplib.TestTLS_FTPClass: "[Errno 54] Connection reset by peer" on "AMD64 FreeBSD CURRENT Debug 3.x" buildbot

2017-05-09 Thread STINNER Victor

Changes by STINNER Victor :


--
keywords: +buildbot

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30315] test_ftplib.TestTLS_FTPClass: "[Errno 54] Connection reset by peer" on "AMD64 FreeBSD CURRENT Debug 3.x" buildbot

2017-05-09 Thread STINNER Victor

New submission from STINNER Victor:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%20CURRENT%20Debug%203.x/builds/246/steps/test/logs/stdio

test_check_hostname (test.test_ftplib.TestTLS_FTPClass) ... Exception in thread 
Thread-84:
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/asyncore.py", 
line 83, in read
obj.handle_read_event()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_ftplib.py",
 line 366, in handle_read_event
super(SSLConnection, self).handle_read_event()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/asyncore.py", 
line 423, in handle_read_event
self.handle_read()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/asynchat.py", 
line 171, in handle_read
self.found_terminator()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_ftplib.py",
 line 116, in found_terminator
method(arg)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_ftplib.py",
 line 207, in cmd_quit
self.close()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_ftplib.py",
 line 406, in close
super(SSLConnection, self).close()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/asyncore.py", 
line 397, in close
self.socket.close()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/socket.py", line 
417, in close
self._real_close()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/socket.py", line 
411, in _real_close
_ss.close(self)
ConnectionResetError: [Errno 54] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/threading.py", 
line 916, in _bootstrap_inner
self.run()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_ftplib.py",
 line 279, in run
asyncore.loop(timeout=0.1, count=1)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/asyncore.py", 
line 207, in loop
poll_fun(timeout, map)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/asyncore.py", 
line 150, in poll
read(obj)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/asyncore.py", 
line 87, in read
obj.handle_error()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_ftplib.py",
 line 399, in handle_error
raise Exception
Exception

ERROR

(...)

==
ERROR: test_check_hostname (test.test_ftplib.TestTLS_FTPClass)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_ftplib.py",
 line 950, in test_check_hostname
self.client.connect("localhost", self.server.port)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/ftplib.py", line 
155, in connect
self.welcome = self.getresp()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/ftplib.py", line 
234, in getresp
resp = self.getmultiline()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/ftplib.py", line 
220, in getmultiline
line = self.getline()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/ftplib.py", line 
202, in getline
line = self.file.readline(self.maxline + 1)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/socket.py", line 
586, in readinto
return self._sock.recv_into(b)
socket.timeout: timed out

--
Ran 89 tests in 15.001s

FAILED (errors=1)
Warning -- threading_cleanup() failed to cleanup 0 threads after 4 sec (count: 
0, dangling: 2)
Warning -- threading._dangling was modified by test_ftplib
  Before: <_weakrefset.WeakSet object at 0x80577ce28>
  After:  <_weakrefset.WeakSet object at 0x80577c810> 
test test_ftplib failed

--
components: Tests
messages: 293326
nosy: haypo
priority: normal
severity: normal
status: open
title: test_ftplib.TestTLS_FTPClass: "[Errno 54] Connection reset by peer" on 
"AMD64 FreeBSD CURRENT Debug 3.x" buildbot
versions: Python 3.7

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30315>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28968] xml rpc server fails with connection reset by peer error no 104

2016-12-23 Thread Martin Panter

Martin Panter added the comment:

Python 2.6 is quite old and doesn’t even receive security patches any more as 
far as I know. I would start by trying 2.7, or failing that, try backporting 
the changes from Issue 6267. My guess is this is related to persistent HTTP 
connections being dropped.

I don’t think the bug tracker is the right place to discuss 2.6 these days. 
Even if you can find someone interested in helping with 2.6, you may need to 
provide more information (e.g. client and server code) to produce the problem.

--
nosy: +martin.panter
resolution:  -> out of date

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28968] xml rpc server fails with connection reset by peer error no 104

2016-12-22 Thread Manish Singh

Manish Singh added the comment:

Below is the information sent to python-dev group

===

[ Issue ]
I have used xml rpc library with transport as http. My client and server are 
running on same host.

Some xml rpc requests fail with connection reset by peer error number. I have 
used xmlrpclib.ServerProxy() to call remote method on xml rpc server running on 
an ephemeral port.

This issue has happen many times.

log snippet,

  File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request
verbose=self.__verbose
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1237, in request
errcode, errmsg, headers = h.getreply()
  File "/usr/lib64/python2.6/httplib.py", line 1064, in getreply
response = self._conn.getresponse()
  File "/usr/lib64/python2.6/httplib.py", line 990, in getresponse
response.begin()
  File "/usr/lib64/python2.6/httplib.py", line 391, in begin
version, status, reason = self._read_status()
  File "/usr/lib64/python2.6/httplib.py", line 349, in _read_status
line = self.fp.readline()
  File "/usr/lib64/python2.6/socket.py", line 433, in readline
data = recv(1)
error: [Errno 104] Connection reset by peer

[ Test Environment ]
RHEL 6 with linux kernel 2.6.32-504.16.2.el6.
Python 2.6.6
glibc-2.12-1.149.7


[ Possible Reasons for it ]

1) The machine is connected to the network, and the network is not responsive. 
2) The other side of the connection is not running normally. 
3) There are not enough system resources available. Free up system resources if 
they are running low. 

Possibility for 1 and 2 are not applicable as it is loop back 
communication(Client and Server running on same machine).
For Possibility 3, I have already checked system resource and there are enough 
resources(80% RAM used, 20% cpu usage, around 10 GB RAM free).

I checked for other reasons and i found that this issue may be related with GIL,
Please refer this link,
http://stackoverflow.com/questions/383738/104-connection-reset-by-peer-socket-error-or-when-does-closing-a-socket-resu
 

1> Can you please let me know, is it really a issue realted with GIL?
2> If yes, How to resolve this issue?
3> If no, what other reason may exists for such failure. [Note: Those rpc 
requests fail which return python's dictionary data to client]




--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28968>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28968] xml rpc server fails with connection reset by peer error no 104

2016-12-22 Thread Manish Singh

Manish Singh added the comment:

Hi Jim,
Thank you for replying.

As you are suggesting that there is a firewall setting.

Then in that case every request should fail, right?

But in my case only few request fail(4 out 20 requests).

Have you seen my mail sent to python-dev group through gmail?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28968] xml rpc server fails with connection reset by peer error no 104

2016-12-22 Thread Jim Jewett

Jim Jewett added the comment:

When I see a message like that, it normally means there is a firewall getting 
in my way.

--
nosy: +Jim.Jewett

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28968] xml rpc server fails with connection reset by peer error no 104

2016-12-21 Thread R. David Murray

R. David Murray added the comment:

The python-list mailing list subscription info can be found on the 
mail.python.org web page.  It is also gatewayed to a usenet news group.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28968] xml rpc server fails with connection reset by peer error no 104

2016-12-21 Thread Manish Singh

Manish Singh added the comment:

Hi David,

How can i port it to main python-dev list.

Need to mail on it or some other group is there so that we can send the message 
to it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28968] xml rpc server fails with connection reset by peer error no 104

2016-12-20 Thread R. David Murray

R. David Murray added the comment:

I'm sorry, I don't have time to dig in to this right now.  Hopefully someone 
else can pick it up.  You might try posting on the python-list mailing list, 
there are several core devs who hang out there and might be interested in the 
problem.

--
nosy:  -loewis

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28968] xml rpc server fails with connection reset by peer error no 104

2016-12-19 Thread Manish Singh

Manish Singh added the comment:

Hi Davud Murray,

Can you reply to above comments.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28968] xml rpc server fails with connection reset by peer error no 104

2016-12-16 Thread Manish Singh

Manish Singh added the comment:

Hi David Murray,

Please refer this link,

http://stackoverflow.com/questions/383738/104-connection-reset-by-peer-socket-error-or-when-does-closing-a-socket-resu

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28968>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28968] xml rpc server fails with connection reset by peer error no 104

2016-12-15 Thread Manish Singh

Manish Singh added the comment:

Hi David Murray,
Thanks for replying.

I have mentioned that my client and server are running on same host. So 
communication is going through localhost address.

I have checked for possible reasons of connection reset by peer error, below 
are the possible causes,

1) The machine is connected to the network, and the network is not responsive. 
2) The other side of the connection is not running normally. 
3) There are not enough system resources available. Free up system resources if 
they are running low. 

Possibility for 1 and 2 are not applicable as it is loopback communication.

For Possibility 3, I have already checked system resource and there are enough 
resources. 

You can check below stack overflow link.
http://stackoverflow.com/questions/1434451/what-does-connection-reset-by-peer-mean?rq=1

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28968>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28968] xml rpc server fails with connection reset by peer error no 104

2016-12-15 Thread R. David Murray

R. David Murray added the comment:

Connection reset by peer means the far end has terminated the connection.  
You'll probably need to do some protocol analysis (wireshark or a similar tool) 
to find out why the connection is being dropped, or perhaps you can look at the 
far end logging.  As it is, there isn't enough information here to speculate as 
to a cause, or if there is any bug in the python library code.

(FYI Martin von Loewis hasn't had much time for CPython development lately, so 
I doubt he'll respond.)

--
nosy: +r.david.murray

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28968>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28968] xml rpc server fails with connection reset by peer error no 104

2016-12-14 Thread Manish Singh

Changes by Manish Singh :


--
nosy: +loewis

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28968] xml rpc server fails with connection reset by peer error no 104

2016-12-14 Thread Manish Singh

Manish Singh added the comment:

Hi loewis,

Can you please look into this issue

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28968] xml rpc server fails with connection reset by peer error no 104

2016-12-14 Thread Manish Singh

New submission from Manish Singh:

I have used xml rpc library with transport http. My client and server are 
running on same host.

In normal load scenario(20% cpu usage, 80% memory usage, 18 GB memory free), 
some request of xml rpc client fails with connection reset by peer error. I 
have used xmlrpclib.ServerProxy() to call remote method on xml rpc server 
running on an empherial port.

This issue has happen many times.

log snippet,

  File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request
verbose=self.__verbose
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1237, in request
errcode, errmsg, headers = h.getreply()
  File "/usr/lib64/python2.6/httplib.py", line 1064, in getreply
response = self._conn.getresponse()
  File "/usr/lib64/python2.6/httplib.py", line 990, in getresponse
response.begin()
  File "/usr/lib64/python2.6/httplib.py", line 391, in begin
version, status, reason = self._read_status()
  File "/usr/lib64/python2.6/httplib.py", line 349, in _read_status
line = self.fp.readline()
  File "/usr/lib64/python2.6/socket.py", line 433, in readline
data = recv(1)
error: [Errno 104] Connection reset by peer

--
components: Library (Lib)
messages: 283180
nosy: manu
priority: normal
severity: normal
status: open
title: xml rpc server fails with connection reset by peer error no 104
type: behavior
versions: Python 2.7

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28968>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28828] Connection reset by peer error when installing python packages

2016-11-28 Thread Emanuel Barry

Emanuel Barry added the comment:

Decorater: For very large projects, the switch from Python 2 to 3 is a 
non-trivial task that can take up years of work, and there are many reasons why 
one cannot switch.

On the issue, however, for all PyPi-related issues, please go to the PyPa 
GitHub: https://github.com/pypa/pypi-legacy/

--
nosy: +ebarry
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28828] Connection reset by peer error when installing python packages

2016-11-28 Thread Decorater

Decorater added the comment:

Also why python 2.7? Python 2.7 does not include asyncio which is absolutely 
awesome to use. It can allow doing multiple different things at the same time. 
So, it is and will be a good thing to upgrade. Note: a lot of things since 2.7 
and 3.x was removed (some exception classes included). But after the change you 
should be fine. Note print from python 2 is a function in python 3.x.

Not only that but 2.x would reach EOL on about 2020 and with it security 
updates for it would close. All the more reasons to use 3.6 when it is released 
officially.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28828] Connection reset by peer error when installing python packages

2016-11-28 Thread Decorater

Decorater added the comment:

Try using the new pypi instead: https://pypi.org/ locate the package then 
override pip to look for that package with the direct link to find the package 
with a command line arg of : -f

ex:

pip3 install -f [direct url to pypi page to package in question here]

According to pip's documentation is says this about -f
If a url or path to an html file, then parse for links to archives. If a local 
path or file:// url that's a directory, then look for archives in the directory 
listing.

Hope this helps.

--
nosy: +Decorater

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28828] Connection reset by peer error when installing python packages

2016-11-28 Thread Rohit Khairnar

New submission from Rohit Khairnar:

We are seeing intermittent "connection reset by peer" connecting to 
pypi.python.org. Pip install "connection reset by peer"

I am a Network Engineer at Hulu and our Devs are seeing error 104 connection 
resets by peer errors. We thought it was a firewall issue but even after 
upgrading it we are still seeing the issues. I can get more details from Devs 
if needed.

regards,
Rohit

--
components: Build
files: pypi.pcap
messages: 281932
nosy: Rohit Khairnar
priority: normal
severity: normal
status: open
title: Connection reset by peer error when installing python packages
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file45680/pypi.pcap

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28828>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: urllib2.urlopen error socket.error: [Errno 104] Connection reset by peer

2015-05-12 Thread dieter
Jia CHEN jia.j.c...@foxmail.com writes:

 I have the error below when trying to download the html content of a webpage. 
 I can open this webpage in a browser without any problem.

Connection reset by peer means that the other side (the HTTP server
in your case) has closed the connection.

It may have looked at the User-Agent request header to differentiate
between a browser request and an automated (script) request.

To work around this, you may provide a User-Agent header
to your urllib2.Request (see the documentation) letting
the User-Agent to look as if the request had been done by a browser
(Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
indicates a firefoy).

-- 
https://mail.python.org/mailman/listinfo/python-list


urllib2.urlopen error socket.error: [Errno 104] Connection reset by peer

2015-05-04 Thread Jia CHEN
Hi There,
 
I have the error below when trying to download the html content of a webpage. I 
can open this webpage in a browser without any problem. I am using Ubuntu 
14.04. Could you give me come clues about what is happening and how to solve 
the issue? Thanks.
 
$python 
 
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
 
[GCC 4.8.2] on linux2
 
Type help, copyright, credits or license for more information.
 
 import urllib2
 
request = 
urllib2.Request('http://guggenheiminvestments.com/products/etf/gsy/holdings')
 
response = urllib2.urlopen(request)
 
  Traceback (most recent call last):
 
File stdin, line 1, in module
 
File /usr/lib/python2.7/urllib2.py, line 127, in urlopen
 
return _opener.open(url, data, timeout)
 
File /usr/lib/python2.7/urllib2.py, line 404, in open
 
response = self._open(req, data)
 
File /usr/lib/python2.7/urllib2.py, line 422, in _open
 
'_open', req)
 
File /usr/lib/python2.7/urllib2.py, line 382, in _call_chain
 
result = func(*args)
 
File /usr/lib/python2.7/urllib2.py, line 1214, in http_open
 
return self.do_open(httplib.HTTPConnection, req)
 
File /usr/lib/python2.7/urllib2.py, line 1187, in do_open
 
r = h.getresponse(buffering=True)
 
File /usr/lib/python2.7/httplib.py, line 1045, in getresponse
 
response.begin()
 
File /usr/lib/python2.7/httplib.py, line 409, in begin
 
version, status, reason = self._read_status()
 
File /usr/lib/python2.7/httplib.py, line 365, in _read_status
 
line = self.fp.readline(_MAXLINE + 1)
 
File /usr/lib/python2.7/socket.py, line 476, in readline
 
data = self._sock.recv(self._rbufsize)
 
socket.error: [Errno 104] Connection reset by peer
 


Best,

Jia CHEN-- 
https://mail.python.org/mailman/listinfo/python-list


Re: http: connection reset by peer

2015-03-06 Thread Chris Angelico
On Sat, Mar 7, 2015 at 9:12 AM, Grant Edwards invalid@invalid.invalid wrote:
 On 2015-03-06, Emile van Sebille em...@fenx.com wrote:
 On 3/5/2015 12:18 PM, Chris Angelico wrote:
 On Fri, Mar 6, 2015 at 5:37 AM, Ethan Furman et...@stoneleaf.us wrote:

 After mucking about with it with no results, I went on to another job
 -- when I came back to this one it was working.

 Huh. Well, if it recurs, see what you can find out about it...
 otherwise, problem solved!

 Well, no remaining symptoms.  I don't consider a problem solved if I
 fail to understand the context.

 In cases like that, I don't call the problem solved.  I prefer to say
 that the problem went away.  :)

It's like with Mythbusters. They ask JD Nelson to help them to make
something 'go away'.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: http: connection reset by peer

2015-03-06 Thread Emile van Sebille

On 3/5/2015 12:18 PM, Chris Angelico wrote:

On Fri, Mar 6, 2015 at 5:37 AM, Ethan Furman et...@stoneleaf.us wrote:



After mucking about with it with no results, I went on to another job -- when I 
came back to this one it was working.


Huh. Well, if it recurs, see what you can find out about it...
otherwise, problem solved!


Well, no remaining symptoms.  I don't consider a problem solved if I 
fail to understand the context.


Emile



--
https://mail.python.org/mailman/listinfo/python-list


Re: http: connection reset by peer

2015-03-06 Thread Grant Edwards
On 2015-03-06, Emile van Sebille em...@fenx.com wrote:
 On 3/5/2015 12:18 PM, Chris Angelico wrote:
 On Fri, Mar 6, 2015 at 5:37 AM, Ethan Furman et...@stoneleaf.us wrote:

 After mucking about with it with no results, I went on to another job
 -- when I came back to this one it was working.

 Huh. Well, if it recurs, see what you can find out about it...
 otherwise, problem solved!

 Well, no remaining symptoms.  I don't consider a problem solved if I 
 fail to understand the context.

In cases like that, I don't call the problem solved.  I prefer to say
that the problem went away.  :)

-- 
Grant Edwards   grant.b.edwardsYow! I think I am an
  at   overnight sensation right
  gmail.comnow!!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: http: connection reset by peer

2015-03-05 Thread Chris Angelico
On Fri, Mar 6, 2015 at 5:37 AM, Ethan Furman et...@stoneleaf.us wrote:
 On 03/04/2015 01:26 AM, Chris Angelico wrote:

 Do you have Mozilla Firebug, and if so, can you try the file
 attachment with Firebug active? At very least, you should be able to
 see exactly what request is getting reset, and then you could try to
 simulate that exact request with a simpler harness (like a Python
 program - see, on-topic now!).

 The connection to the server was reset while the page was loading.

 After mucking about with it with no results, I went on to another job -- when 
 I came back to this one it was working.

Huh. Well, if it recurs, see what you can find out about it...
otherwise, problem solved!

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: http: connection reset by peer

2015-03-05 Thread Ethan Furman
On 03/04/2015 01:26 AM, Chris Angelico wrote:

 Do you have Mozilla Firebug, and if so, can you try the file
 attachment with Firebug active? At very least, you should be able to
 see exactly what request is getting reset, and then you could try to
 simulate that exact request with a simpler harness (like a Python
 program - see, on-topic now!).

The connection to the server was reset while the page was loading.

After mucking about with it with no results, I went on to another job -- when I 
came back to this one it was working.

--
~Ethan~



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: http: connection reset by peer

2015-03-04 Thread Ethan Furman
On 03/04/2015 01:26 AM, Chris Angelico wrote:
 On Wed, Mar 4, 2015 at 5:33 PM, Ethan Furman wrote:

 I login to the roundup server -- I can search, create new issues, post new 
 messages via both email and the web
 interface, and I can attach files... but only via email; if I try to attach 
 a file via the web interface I immediately
 get a connection reset message.

 I have tried with FireFox and Midori, with and without Apache in the middle 
 as a proxy server, I have googled all day
 long looking for answers, and I've been coming up empty.
 
 Do you have Mozilla Firebug, and if so, can you try the file
 attachment with Firebug active?

I do, and I'll try.

 At very least, you should be able to
 see exactly what request is getting reset, and then you could try to
 simulate that exact request with a simpler harness (like a Python
 program - see, on-topic now!).

Heh, thanks.

--
~Ethan~



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: http: connection reset by peer

2015-03-04 Thread Chris Angelico
On Wed, Mar 4, 2015 at 5:33 PM, Ethan Furman et...@stoneleaf.us wrote:
 I login to the roundup server -- I can search, create new issues, post new 
 messages via both email and the web
 interface, and I can attach files... but only via email; if I try to attach a 
 file via the web interface I immediately
 get a connection reset message.

 I have tried with FireFox and Midori, with and without Apache in the middle 
 as a proxy server, I have googled all day
 long looking for answers, and I've been coming up empty.

Do you have Mozilla Firebug, and if so, can you try the file
attachment with Firebug active? At very least, you should be able to
see exactly what request is getting reset, and then you could try to
simulate that exact request with a simpler harness (like a Python
program - see, on-topic now!).

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


http: connection reset by peer

2015-03-03 Thread Ethan Furman
This may seem off-topic, but it's an issue for my roundup server which is 
written in Python, so hopefully that will buy
me some slack. ;)

And, yes, I did post a message to the Roundup Users mailing list first, but 
haven't received any replies.

So, the basic problem is:

I login to the roundup server -- I can search, create new issues, post new 
messages via both email and the web
interface, and I can attach files... but only via email; if I try to attach a 
file via the web interface I immediately
get a connection reset message.

I have tried with FireFox and Midori, with and without Apache in the middle as 
a proxy server, I have googled all day
long looking for answers, and I've been coming up empty.

The server is ubuntu 12.04, Roundup is at 1.5.0, and Firefox has been several 
versions, and Midori is 0.4.3.  Roundup
has been slightly modified to support timezones, reverse date order for 
listings, auto-nosy -- nothing major.

Any clues greatly appreciated.

--
~Ethan~



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Diagnosing socket Connection reset by peer

2013-05-22 Thread loial
I have a sockets client that is connecting to a printer and occassionally 
getting the error 104 Connection reset by peer

I have not been able to diagnose what is causing this. Is there any additional 
traceing I can do(either within my python code or on the network) to establish 
what is causing this error?

Currently I am simply trapping socket.erruor 

Python version is 2.6






-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Diagnosing socket Connection reset by peer

2013-05-22 Thread Matt Jones
This typically indicates that the peer at the other end of the tcp
connection severed the session without the typical FIN packet.  If you're
treating the printer as a blackbox then there really isn't anything you
can do here except catch the exception and attempt to reconnect.

*Matt Jones*


On Wed, May 22, 2013 at 3:46 AM, loial jldunn2...@gmail.com wrote:

 I have a sockets client that is connecting to a printer and occassionally
 getting the error 104 Connection reset by peer

 I have not been able to diagnose what is causing this. Is there any
 additional traceing I can do(either within my python code or on the
 network) to establish what is causing this error?

 Currently I am simply trapping socket.erruor

 Python version is 2.6






 --
 http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Diagnosing socket Connection reset by peer

2013-05-22 Thread Dave Angel

On 05/22/2013 04:46 AM, loial wrote:

   SNIP

 Is there any additional traceing I can do(either within my python code or 
on the network) to establish what is causing this error?




Try using Wireshark.  It can do a remarkable job of filtering, 
capturing, and analyzing packets.  It can also read and write pcap 
files, which you could either save for later analysis, or send to 
someone who might help.  (Note - unfiltered pcap files can be very large 
on a busy network, but if you can quiet other traffic, you may not need 
to filter at all.)



--
DaveA
--
http://mail.python.org/mailman/listinfo/python-list


Re: Diagnosing socket Connection reset by peer

2013-05-22 Thread Jorgen Grahn
On Wed, 2013-05-22, Dave Angel wrote:
 On 05/22/2013 04:46 AM, loial wrote:
SNIP

  Is there any additional traceing I can do(either within my
 python code or on the network) to establish what is causing this
 error?

 Try using Wireshark.  It can do a remarkable job of filtering, 
 capturing, and analyzing packets.  It can also read and write pcap 
 files, which you could either save for later analysis, or send to 
 someone who might help.

Or use tcpdump, which has a text interface so you can show the problem
in a text medium like Usenet.

 (Note - unfiltered pcap files can be very large 
 on a busy network, but if you can quiet other traffic, you may not need 
 to filter at all.)

Or simply filter.  It's not hard -- the capture filter
host my-printer-hostname-or-address is enough.

/Jorgen

-- 
  // Jorgen Grahn grahn@  Oo  o.   . .
\X/ snipabacken.se   O  o   .
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Diagnosing socket Connection reset by peer

2013-05-22 Thread Jorgen Grahn
On Wed, 2013-05-22, Matt Jones wrote:
 On Wed, May 22, 2013 at 3:46 AM, loial jldunn2...@gmail.com wrote:

 I have a sockets client that is connecting to a printer and occassionally
 getting the error 104 Connection reset by peer

 I have not been able to diagnose what is causing this. Is there any
 additional traceing I can do(either within my python code or on the
 network) to establish what is causing this error?

 Currently I am simply trapping socket.erruor

 Python version is 2.6

 This typically indicates that the peer at the other end of the tcp
 connection severed the session without the typical FIN packet.

I.e. by sending a RST (reset) instead.  Yes, that's what Connection
reset by peer means.  I don't think there are any other causes for
this signal.

A server application can cause a reset explicitly, or if it crashes
the OS will send one for it, as part of the resource cleanup.

Also, if you're behind a cheap NATing gateway, I think it may send
fake RSTs if it has lost track of the TCP session.

 If you're
 treating the printer as a blackbox then there really isn't anything you
 can do here except catch the exception and attempt to reconnect.

Yes.  Note that there *may* be some uncertainty re: did the printer
process the last request before the reset or not? E.g. I wouldn't
endlessly retry printing a 100-page document in that case.

/Jorgen

-- 
  // Jorgen Grahn grahn@  Oo  o.   . .
\X/ snipabacken.se   O  o   .
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Diagnosing socket Connection reset by peer

2013-05-22 Thread Grant Edwards
On 2013-05-22, Jorgen Grahn grahn+n...@snipabacken.se wrote:
 On Wed, 2013-05-22, Dave Angel wrote:
 On 05/22/2013 04:46 AM, loial wrote:
SNIP

  Is there any additional traceing I can do(either within my
 python code or on the network) to establish what is causing this
 error?

 Try using Wireshark.  It can do a remarkable job of filtering, 
 capturing, and analyzing packets.  It can also read and write pcap 
 files, which you could either save for later analysis, or send to 
 someone who might help.

 Or use tcpdump, which has a text interface so you can show the problem
 in a text medium like Usenet.

There's also tshark, which is sort of a command-line version of
wireshark.

http://www.wireshark.org/docs/man-pages/tshark.html

 (Note - unfiltered pcap files can be very large on a busy network,
 but if you can quiet other traffic, you may not need to filter at
 all.)

 Or simply filter.  It's not hard -- the capture filter host
 my-printer-hostname-or-address is enough.

Indeed.  Even a simple filter can make life several orders of
magnitude easier.  If filtering by IP address isn't enough, the next
step is usually to add a port number filter...

-- 
Grant Edwards   grant.b.edwardsYow! Of course, you
  at   UNDERSTAND about the PLAIDS
  gmail.comin the SPIN CYCLE --
-- 
http://mail.python.org/mailman/listinfo/python-list


How to raise a socket 104 connection reset by peer error

2013-05-21 Thread loial
For testing purposes I want my code to raise a socket connection reset by 
peer error, so that I can test how I handle it, but I am not sure how to raise 
the error.

Any advice appreciated

  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to raise a socket 104 connection reset by peer error

2013-05-21 Thread Andrew Berg
On 2013.05.21 10:26, loial wrote:
 For testing purposes I want my code to raise a socket connection reset by 
 peer error, so that I can test how I handle it, but I am not sure how to 
 raise the error.
Arbitrary exceptions can be raised with the raise keyword. In Python 3.3, that 
exact error got its own builtin exception:
http://docs.python.org/3.3/tutorial/errors.html#raising-exceptions
http://docs.python.org/3.3/library/exceptions.html#ConnectionResetError

In earlier versions of Python, you will have to raise OSError and set its errno 
attribute.

-- 
CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Connection reset by peer

2011-09-14 Thread Thomas Jollans
On 14/09/11 04:39, 守株待兔 wrote:
 i  want to know,  my  computer(client)  reset  it  ,or  the yahoo
 (server)  reset it ,what is the peer?? 

This refers to your program's peer, as in the entity it's communicating
with. When you're the client, the other party (which, once the
connection is established, is considered to be of equal rank - a peer)
is the server.

tl;dr: yahoo.
-- 
http://mail.python.org/mailman/listinfo/python-list


Connection reset by peer

2011-09-13 Thread 守株待兔
there is a multi-threads program  dowloading  data from yahoo,the main 
structure is as the following(omit something  unimportant )


class   webdata(object):
def  __init__(self,name):
self.jobs = Queue.Queue()
if  x  in  name:
self.jobs.put(x)
def  download(self):
   try:
weburl=self.jobs.get()
url = weburl
hx = httplib2.Http()
resp, content = hx.request(url, headers=headers)   
print
self.jobs.task_done()
except:
print  url,wrong
self.jobs.task_done()
   
def  run(self):   
for i in range(30):
  threading.Thread(target=self.download).start()  
self.jobs.join()
   
if  __name__==__main__: 
 webdata('quote').run()



quote  is  a  list  which  i want to download,i was confused ,this program  can 
download something,
can't download something,
when i cancel  try,except , i get the output:
File /usr/local/lib/python2.7/dist-packages/httplib2/__init__.py, line 1436, 
in request
(response, content) = self._request(conn, authority, uri, request_uri, 
method, body, headers, redirections, cachekey)
  File /usr/local/lib/python2.7/dist-packages/httplib2/__init__.py, line 
1188, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, 
headers)
  File /usr/local/lib/python2.7/dist-packages/httplib2/__init__.py, line 
1171, in _conn_request
content = response.read()
  File /usr/lib/python2.7/httplib.py, line 541, in read
return self._read_chunked(amt)
  File /usr/lib/python2.7/httplib.py, line 590, in _read_chunked
value.append(self._safe_read(chunk_left))
  File /usr/lib/python2.7/httplib.py, line 647, in _safe_read
chunk = self.fp.read(min(amt, MAXAMOUNT))
  File /usr/lib/python2.7/socket.py, line 380, in read
data = self._sock.recv(left)
error: [Errno 104] Connection reset by peer

i  want to know,  my  computer(client)  reset  it  ,or  the yahoo (server)  
reset it ,what is the peer??-- 
http://mail.python.org/mailman/listinfo/python-list


connection reset by peer error

2008-10-11 Thread gigs
I connect to web site with httplib.HTTPConnection. after some time i get this 
error: 104 connection reset by peer. What exception i should use to catche 
this error


thx!
--
http://mail.python.org/mailman/listinfo/python-list


Re: connection reset by peer error

2008-10-11 Thread D'Arcy J.M. Cain
On Sat, 11 Oct 2008 15:52:48 +0200
gigs [EMAIL PROTECTED] wrote:
 I connect to web site with httplib.HTTPConnection. after some time i get this 
 error: 104 connection reset by peer. What exception i should use to catche 
 this error

Well, what exception do you get?  Your traceback should tell you.

-- 
D'Arcy J.M. Cain [EMAIL PROTECTED] |  Democracy is three wolves
http://www.druid.net/darcy/|  and a sheep voting on
+1 416 425 1212 (DoD#0082)(eNTP)   |  what's for dinner.
--
http://mail.python.org/mailman/listinfo/python-list


Re: connection reset by peer error

2008-10-11 Thread gigs

D'Arcy J.M. Cain wrote:

On Sat, 11 Oct 2008 15:52:48 +0200
gigs [EMAIL PROTECTED] wrote:
I connect to web site with httplib.HTTPConnection. after some time i get this 
error: 104 connection reset by peer. What exception i should use to catche 
this error


Well, what exception do you get?  Your traceback should tell you.


i dont remember now
my problem is now that i need to wait few hours to get this error. now i close 
my connection after one hour and reconnect. so i dont get that error anymore, 
but i would like to catch that error and reconect after it happens.


i dont have time to wait for that error now.
--
http://mail.python.org/mailman/listinfo/python-list


Re: urllib (54, 'Connection reset by peer') error

2008-06-21 Thread John Nagle

Tim Golden wrote:

[EMAIL PROTECTED] wrote:

Thanks for the help.  The error handling worked to a certain extent
but after a while the server does seem to stop responding to my
requests.

I have a list of about 7,000 links to pages I want to parse the HTML
of (it's basically a web crawler) but after a certain number of
urlretrieve() or urlopen() calls the server just stops responding.
Anyone know of a way to get around this?  I don't own the server so I
can't make any modifications on that side.


I think someone's already mentioned this, but it's almost
certainly an explicit or implicit throttling on the remote server.
If you're pulling 7,000 pages from a single server you need to
be sure that you're within the Terms of Use of that service, or
at the least you need to contact the maintainers in courtesy to
confirm that this is acceptable.

If you don't you may well cause your IP block to be banned on
their network, which could affect others as well as yourself.


   Interestingly, lp.findlaw.com doesn't have any visible terms of service.
The information being downloaded is case law, which is public domain, so
there's no copyright issue.  Some throttling and retry is needed to slow
down the process, but it should be fixable.

   Try this: put in the retry code someone else suggested.  Use a variable
retry delay, and wait one retry delay between downloading files.  Whenever
a download fails, double the retry delay and try
again; don't let it get bigger than, say, 256 seconds.  When a download
succeeds, halve the retry delay, but don't let it get smaller than 1 second.
That will make your downloader self-tune to the throttling imposed by
the server.

John Nagle
--
http://mail.python.org/mailman/listinfo/python-list


Re: urllib (54, 'Connection reset by peer') error

2008-06-18 Thread chrispoliquin
Thanks for the help.  The error handling worked to a certain extent
but after a while the server does seem to stop responding to my
requests.

I have a list of about 7,000 links to pages I want to parse the HTML
of (it's basically a web crawler) but after a certain number of
urlretrieve() or urlopen() calls the server just stops responding.
Anyone know of a way to get around this?  I don't own the server so I
can't make any modifications on that side.
--
http://mail.python.org/mailman/listinfo/python-list


Re: urllib (54, 'Connection reset by peer') error

2008-06-18 Thread Tim Golden

[EMAIL PROTECTED] wrote:

Thanks for the help.  The error handling worked to a certain extent
but after a while the server does seem to stop responding to my
requests.

I have a list of about 7,000 links to pages I want to parse the HTML
of (it's basically a web crawler) but after a certain number of
urlretrieve() or urlopen() calls the server just stops responding.
Anyone know of a way to get around this?  I don't own the server so I
can't make any modifications on that side.


I think someone's already mentioned this, but it's almost
certainly an explicit or implicit throttling on the remote server.
If you're pulling 7,000 pages from a single server you need to
be sure that you're within the Terms of Use of that service, or
at the least you need to contact the maintainers in courtesy to
confirm that this is acceptable.

If you don't you may well cause your IP block to be banned on
their network, which could affect others as well as yourself.

TJG
--
http://mail.python.org/mailman/listinfo/python-list


urllib (54, 'Connection reset by peer') error

2008-06-13 Thread chrispoliquin
Hi,

I have a small Python script to fetch some pages from the internet.
There are a lot of pages and I am looping through them and then
downloading the page using urlretrieve() in the urllib module.

The problem is that after 110 pages or so the script sort of hangs and
then I get the following traceback:


Traceback (most recent call last):
  File volume_archiver.py, line 21, in module
urllib.urlretrieve(remotefile,localfile)
  File /Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/urllib.py, line 89, in urlretrieve
return _urlopener.retrieve(url, filename, reporthook, data)
  File /Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/urllib.py, line 222, in retrieve
fp = self.open(url, data)
  File /Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/urllib.py, line 190, in open
return getattr(self, name)(url)
  File /Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/urllib.py, line 328, in open_http
errcode, errmsg, headers = h.getreply()
  File /Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/httplib.py, line 1195, in getreply
response = self._conn.getresponse()
  File /Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/httplib.py, line 924, in getresponse
response.begin()
  File /Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/httplib.py, line 385, in begin
version, status, reason = self._read_status()
  File /Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/httplib.py, line 343, in _read_status
line = self.fp.readline()
  File /Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/socket.py, line 331, in readline
data = recv(1)
IOError: [Errno socket error] (54, 'Connection reset by peer')


My script code is as follows:
-
import os
import urllib

volume_number = 149 # The volumes number 150 to 544

while volume_number  544:
volume_number = volume_number + 1
localfile = '/Users/Chris/Desktop/Decisions/' + str(volume_number) +
'.html'
remotefile = 'http://caselaw.lp.findlaw.com/scripts/getcase.pl?
court=usnavby=volvol=' + str(volume_number)
print 'Getting volume number:', volume_number
urllib.urlretrieve(remotefile,localfile)

print 'Download complete.'
-

Once I get the error once running the script again doesn't do much
good.  It usually gets two or three pages and then hangs again.

What is causing this?






--
http://mail.python.org/mailman/listinfo/python-list


Re: urllib (54, 'Connection reset by peer') error

2008-06-13 Thread Chris
On Jun 13, 4:21 pm, [EMAIL PROTECTED] wrote:
 Hi,

 I have a small Python script to fetch some pages from the internet.
 There are a lot of pages and I am looping through them and then
 downloading the page using urlretrieve() in the urllib module.

 The problem is that after 110 pages or so the script sort of hangs and
 then I get the following traceback:



 Traceback (most recent call last):
   File volume_archiver.py, line 21, in module
     urllib.urlretrieve(remotefile,localfile)
   File /Library/Frameworks/Python.framework/Versions/2.5/lib/
 python2.5/urllib.py, line 89, in urlretrieve
     return _urlopener.retrieve(url, filename, reporthook, data)
   File /Library/Frameworks/Python.framework/Versions/2.5/lib/
 python2.5/urllib.py, line 222, in retrieve
     fp = self.open(url, data)
   File /Library/Frameworks/Python.framework/Versions/2.5/lib/
 python2.5/urllib.py, line 190, in open
     return getattr(self, name)(url)
   File /Library/Frameworks/Python.framework/Versions/2.5/lib/
 python2.5/urllib.py, line 328, in open_http
     errcode, errmsg, headers = h.getreply()
   File /Library/Frameworks/Python.framework/Versions/2.5/lib/
 python2.5/httplib.py, line 1195, in getreply
     response = self._conn.getresponse()
   File /Library/Frameworks/Python.framework/Versions/2.5/lib/
 python2.5/httplib.py, line 924, in getresponse
     response.begin()
   File /Library/Frameworks/Python.framework/Versions/2.5/lib/
 python2.5/httplib.py, line 385, in begin
     version, status, reason = self._read_status()
   File /Library/Frameworks/Python.framework/Versions/2.5/lib/
 python2.5/httplib.py, line 343, in _read_status
     line = self.fp.readline()
   File /Library/Frameworks/Python.framework/Versions/2.5/lib/
 python2.5/socket.py, line 331, in readline
     data = recv(1)
 IOError: [Errno socket error] (54, 'Connection reset by peer')



 My script code is as follows:
 -
 import os
 import urllib

 volume_number = 149 # The volumes number 150 to 544

 while volume_number  544:
         volume_number = volume_number + 1
         localfile = '/Users/Chris/Desktop/Decisions/' + str(volume_number) +
 '.html'
         remotefile = 'http://caselaw.lp.findlaw.com/scripts/getcase.pl?
 court=usnavby=volvol=' + str(volume_number)
         print 'Getting volume number:', volume_number
         urllib.urlretrieve(remotefile,localfile)

 print 'Download complete.'
 -

 Once I get the error once running the script again doesn't do much
 good.  It usually gets two or three pages and then hangs again.

 What is causing this?

The server is causing it, you could just alter your code

import os
import urllib
import time

volume_number = 149 # The volumes number 150 to 544
localfile = '/Users/Chris/Desktop/Decisions/%s.html'
remotefile = 'http://caselaw.lp.findlaw.com/scripts/getcase.pl?
court=usnavby=volvol=%s'
while volume_number  544:
volume_number += 1
print 'Getting volume number:', volume_number
try:
urllib.urlretrieve(remotefile%volume_number,localfile
%volume_number)
except IOError:
volume_number -= 1
time.sleep(5)

print 'Download complete.'

That way if the attempt fails it rolls back the volume number, pauses
for a few seconds and tries again.
--
http://mail.python.org/mailman/listinfo/python-list


Re: urllib (54, 'Connection reset by peer') error

2008-06-13 Thread Jeff McNeil
It means your client received a TCP segment with the reset bit sent.
The 'peer' will toss one your way if it determines that a connection
is no longer valid or if it receives a bad sequence number. If I had
to hazard a guess, I'd say it's probably a network device on the
server side trying to stop you from running a mass download
(especially if it's easily repeatable and happens at about the same
byte range).

-Jeff




On Fri, Jun 13, 2008 at 10:21 AM,  [EMAIL PROTECTED] wrote:
 Hi,

 I have a small Python script to fetch some pages from the internet.
 There are a lot of pages and I am looping through them and then
 downloading the page using urlretrieve() in the urllib module.

 The problem is that after 110 pages or so the script sort of hangs and
 then I get the following traceback:


 Traceback (most recent call last):
  File volume_archiver.py, line 21, in module
urllib.urlretrieve(remotefile,localfile)
  File /Library/Frameworks/Python.framework/Versions/2.5/lib/
 python2.5/urllib.py, line 89, in urlretrieve
return _urlopener.retrieve(url, filename, reporthook, data)
  File /Library/Frameworks/Python.framework/Versions/2.5/lib/
 python2.5/urllib.py, line 222, in retrieve
fp = self.open(url, data)
  File /Library/Frameworks/Python.framework/Versions/2.5/lib/
 python2.5/urllib.py, line 190, in open
return getattr(self, name)(url)
  File /Library/Frameworks/Python.framework/Versions/2.5/lib/
 python2.5/urllib.py, line 328, in open_http
errcode, errmsg, headers = h.getreply()
  File /Library/Frameworks/Python.framework/Versions/2.5/lib/
 python2.5/httplib.py, line 1195, in getreply
response = self._conn.getresponse()
  File /Library/Frameworks/Python.framework/Versions/2.5/lib/
 python2.5/httplib.py, line 924, in getresponse
response.begin()
  File /Library/Frameworks/Python.framework/Versions/2.5/lib/
 python2.5/httplib.py, line 385, in begin
version, status, reason = self._read_status()
  File /Library/Frameworks/Python.framework/Versions/2.5/lib/
 python2.5/httplib.py, line 343, in _read_status
line = self.fp.readline()
  File /Library/Frameworks/Python.framework/Versions/2.5/lib/
 python2.5/socket.py, line 331, in readline
data = recv(1)
 IOError: [Errno socket error] (54, 'Connection reset by peer')


 My script code is as follows:
 -
 import os
 import urllib

 volume_number = 149 # The volumes number 150 to 544

 while volume_number  544:
volume_number = volume_number + 1
localfile = '/Users/Chris/Desktop/Decisions/' + str(volume_number) +
 '.html'
remotefile = 'http://caselaw.lp.findlaw.com/scripts/getcase.pl?
 court=usnavby=volvol=' + str(volume_number)
print 'Getting volume number:', volume_number
urllib.urlretrieve(remotefile,localfile)

 print 'Download complete.'
 -

 Once I get the error once running the script again doesn't do much
 good.  It usually gets two or three pages and then hangs again.

 What is causing this?






 --
 http://mail.python.org/mailman/listinfo/python-list

--
http://mail.python.org/mailman/listinfo/python-list


Re: smtplib error('Connection reset by peer')

2006-01-08 Thread Tim Roberts
Van_Gogh [EMAIL PROTECTED] wrote:

I am learning how to use the smtplib module, but am having some very
early problems, maybe because I don't understand it.
So, am I correct that by following the example in the Python:

 import smtplib
 server = smtplib.SMTP('localhost')
 server.sendmail('[EMAIL PROTECTED]', '[EMAIL PROTECTED]',
To: [EMAIL PROTECTED]
From: [EMAIL PROTECTED]

Beware the Ides of March.
)
 server.quit()

I should be able to send an email to the recipient, in this case
[EMAIL PROTECTED] When I try to create the server(the line 'server =
smtplib.SMTP('localhost')) I get the following error message:
...
error: (10054, 'Connection reset by peer')

Anyone got a pointer as to what I could do?

Replace localhost with the name of your usual outgoing mail server.

Although there ARE SMTP servers available for Windows XP, is it virtually
certain that you aren't running one.
-- 
- Tim Roberts, [EMAIL PROTECTED]
  Providenza  Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: smtplib error('Connection reset by peer')

2006-01-06 Thread LordLaraby
Do you actually run an SMTP server on your local machine and is it
configured to accept mail on the localhost interface and does it allow
mail forwarding such as you attempted?

LL

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: smtplib error('Connection reset by peer')

2006-01-05 Thread Tim Williams (gmail)
On 4 Jan 2006 15:47:34 -0800, Van_Gogh [EMAIL PROTECTED] wrote:
Hi,I am learning how to use the smtplib module, but am having some veryearly problems, maybe because I don't understand it.So, am I correct that by following the example in the Python:

[snip] 
When I try to create the server(the line 'server =smtplib.SMTP('localhost')) I get the following error message:

[snip] 
error: (10054, 'Connection reset by peer')Anyone got a pointer as to what I could do?

Try turning off your XP firewall . If this doesn't help, try this from a command prompt

c:\ telnet localhost 25 (return)

you should get some response from your server beginning with 220, if not then Python isn't the problem.

in the telnet session, type quit  + return to end the session.

HTH :)
-- Tim Williams
-- 
http://mail.python.org/mailman/listinfo/python-list

smtplib error('Connection reset by peer')

2006-01-04 Thread Van_Gogh
Hi,

I am learning how to use the smtplib module, but am having some very
early problems, maybe because I don't understand it.
So, am I correct that by following the example in the Python:

 import smtplib
 server = smtplib.SMTP('localhost')
 server.sendmail('[EMAIL PROTECTED]', '[EMAIL PROTECTED]',
To: [EMAIL PROTECTED]
From: [EMAIL PROTECTED]

Beware the Ides of March.
)
 server.quit()

I should be able to send an email to the recipient, in this case
[EMAIL PROTECTED] When I try to create the server(the line 'server =
smtplib.SMTP('localhost')) I get the following error message:

Traceback (most recent call last):
  File pyshell#1, line 1, in -toplevel-
server = smtplib.SMTP('localhost')
  File C:\Python24\lib\smtplib.py, line 241, in __init__
(code, msg) = self.connect(host, port)
  File C:\Python24\lib\smtplib.py, line 304, in connect
(code, msg) = self.getreply()
  File C:\Python24\lib\smtplib.py, line 345, in getreply
line = self.file.readline()
  File C:\Python24\lib\socket.py, line 340, in readline
data = self._sock.recv(self._rbufsize)
error: (10054, 'Connection reset by peer')

Anyone got a pointer as to what I could do?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: smtplib error('Connection reset by peer')

2006-01-04 Thread Van_Gogh
I should mention that I'm on Windows XP.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Minimizing Connection reset by peer exceptions

2005-10-20 Thread Ben Sizer

[EMAIL PROTECTED] wrote:

 Occasionally (perhaps 5% of the time) the following exception gets
 raised:

 (10054, 'Connection reset by peer')

Generally this just means the connection has closed through some
unusual means, perhaps by being turned off, or a network cable being
unplugged, or a timeout along the way, etc. 5% is a high figure, but
perhaps you connect to hosts that are unreliable for some reason.

You don't have control over this really; just make sure you handle the
exception. Such is life, when dealing with networking.

-- 
Ben Sizer

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Minimizing Connection reset by peer exceptions

2005-10-20 Thread Steve Holden
Ben Sizer wrote:
 [EMAIL PROTECTED] wrote:
 
 
Occasionally (perhaps 5% of the time) the following exception gets
raised:

(10054, 'Connection reset by peer')
 
 
 Generally this just means the connection has closed through some
 unusual means, perhaps by being turned off, or a network cable being
 unplugged, or a timeout along the way, etc. 5% is a high figure, but
 perhaps you connect to hosts that are unreliable for some reason.
 
 You don't have control over this really; just make sure you handle the
 exception. Such is life, when dealing with networking.
 
Do note, though, that if you aren't using some means (threading, 
forking, etc) of handling the connections asynchronously then your 
server will normally only queue a very limited number of connections 
(usually 5 at most).

So if your service takes a while to run then it's possible that 
connection requests will be rejected when the queue is full, which might 
*possibly* result in the error you are seeing.

Feel free to ignore this if you only have one client at a time.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006  www.python.org/pycon/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Minimizing Connection reset by peer exceptions

2005-10-20 Thread Ben Sizer

Steve Holden wrote:

 Do note, though, that if you aren't using some means (threading,
 forking, etc) of handling the connections asynchronously then your
 server will normally only queue a very limited number of connections
 (usually 5 at most).

The example given by the original poster seemed to be a client (using
connect_ex) rather than a server, so I think this would only be an
issue if the code was connecting to the same host repeatedly in quick
succession.

-- 
Ben Sizer

-- 
http://mail.python.org/mailman/listinfo/python-list


Minimizing Connection reset by peer exceptions

2005-10-19 Thread mirandacascade
This may be more of a socket question than a python question; not sure.

Using this code to instantiate/connect/set options
connectionHandle = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
errorStatus = connectionHandle.connect_ex((ipAddress, port))
connectionHandle.setsockopt(socket.SOL_SOCKET, socket.SO_RCVTIMEO,
6)

Using this code to send:
retSendAll = connectionHandle.sendall(messageToHost)

Followed by this code to recv:
bufferSize = 50
responseBuffer = connectionHandle.recv(bufferSize)

Occasionally (perhaps 5% of the time) the following exception gets
raised:

(10054, 'Connection reset by peer')


Are there any changes I can make to the code above to eliminate the
10054 errors or to reduce the probability of encountering the 10054
error?  Are there any settings that make the 'Connection reset by
peer' condition less likely?

Other posts on this subject seem to suggest that this can only be
handled by:
1) detecting the 10054 error
2) issuing a message explaining the 'connection reset' condition
followed by something along the lines of 'try again later'.

-- 
http://mail.python.org/mailman/listinfo/python-list