[issue27682] Windows Error 10053, ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

2016-08-09 Thread R. David Murray

R. David Murray added the comment:

Kristján: right, what I'm saying about the possible bug is the final part of 
the traceback resulting from (apparently) wsgiref being closed and a new 
operation being attempted.  *Probably* that is a django bug in handling a 
network error, but maybe it is a wsgiref bug in handling the network error.  
(I'm assuming here that the Windows error is triggered by the retry, but I 
could of course be completely wrong about that.)

--

___
Python tracker 

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



[issue27682] Windows Error 10053, ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

2016-08-09 Thread Kristján Valur Jónsson

Kristján Valur Jónsson added the comment:

As already stated, this error bubbles up from the TCP layer.  It means that the 
tcp stack, for example, gave up resending a tcp frame and timed out, 
determining that the recipient was no longer listening.
You cannot create this error yourself.  If you, for example, call 
s.shutdown(SHUT_WR), you get a WSAESHUTDOWN error.  If the connection is closed 
(via s.close()) you get a EBADF error.
Now, the interaction with the client may cause the client to misbehave, but 
this sort of error is usually either due to the network (other host becomes 
unreachable) or misconfiguration of the local host's tcp stack.

--

___
Python tracker 

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



[issue27682] Windows Error 10053, ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

2016-08-09 Thread R. David Murray

R. David Murray added the comment:

Given that django is involved, it looks like it is most likely django that is 
calling the method after wsgiref is closed.  This doesn't *look* like a stdlib 
problem from what we can see so far, but it certainly could be.  We'd need a 
reproducer that didn't involve django to make any further progress from our 
side.

--

___
Python tracker 

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



[issue27682] Windows Error 10053, ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

2016-08-09 Thread Kristján Valur Jónsson

Kristján Valur Jónsson added the comment:

This error is a protocol error.  It is the analog to WSAECONNRESET.
ECONNRESET occurs when the local host receives a RST packet from the peer, 
usually because the peer closed the connection.
WSAECONNABORT occurs when the local tcp layer decides that the connection is 
dead, (it may have sent RST to the peer itself).  This can occur for various 
reasons.  Often because the client has cone away, closed the connection or 
other things.  It is best to treat WSACONNRESET as WSACONNABORT, i.e., there 
was a TCP protocol error and the transaction (http request) probably wasn't 
completed completely by both parties.  See also here:
https://www.chilkatsoft.com/p/p_299.asp

In your case, I would expect a problem with the client uploading the file.  It 
probably closes the connection after sending the data without waiting for the 
http response.

--

___
Python tracker 

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



[issue27682] Windows Error 10053, ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

2016-08-08 Thread Philip Lee

Philip Lee added the comment:

I use the following django view function also produce the same exception 

def sendFiles(request): 
fileName = request.GET['fileName']

pathToFile = os.path.join(filesDir, fileName)
response = FileResponse(open(pathToFile, 'rb'))

response['Content-Type'] = 'application/octet-stream'
response[
'Content-Disposition'] = 'attachment; fileName="{}"'.format(fileName)
response['Content-Length'] = os.path.getsize(pathToFile)
# HttpResponse(open(os.path.join(os.getcwd(), 'LYYDownloaderServer.log'), 
'r'), content_type='text/plain')
return response

Tested with sending file Git-2.8.4-32-bit.exe (29.8MB), if tested with sending 
file GitHubSetup.exe(670kb),then no exception occurred.

the exception like the following 

return self._sock.send(b)
ConnectionAbortedError: [WinError 10053] 您的主机中的软件中止了一个已建立的连接
。
[09/Aug/2016 10:30:13] "GET /FileHost/?fileName=Git-2.8.4-32-bit.exe HTTP/1.1" 5
00 59

Exception happened during processing of request from ('127.0.0.1', 62237)
Traceback (most recent call last):
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 138, in run
self.finish_response()
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 180, in finish_response
self.write(data)
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 274, in write
self.send_headers()
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 332, in send_headers
self.send_preamble()
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 453, in _write
result = self.stdout.write(data)
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\socket.py", lin
e 593, in write
return self._sock.send(b)
ConnectionAbortedError: [WinError 10053] 您的主机中的软件中止了一个已建立的连接
。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 141, in run
self.handle_error()
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\site-packages\d
jango\core\servers\basehttp.py", line 92, in handle_error
super(ServerHandler, self).handle_error()
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 368, in handle_error
self.finish_response()
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 180, in finish_response
self.write(data)
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 274, in write
self.send_headers()
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 344, in client_is_modern
return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py
", line 625, in process_request_thread
self.finish_request(request, client_address)
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py
", line 354, in finish_request
self.RequestHandlerClass(request, client_address, self)
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\site-packages\d
jango\core\servers\basehttp.py", line 99, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py
", line 681, in __init__
self.handle()
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\site-packages\d
jango\core\servers\basehttp.py", line 179, in handle
handler.run(self.server.get_app())
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 144, in run
self.close()
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\simple_
server.py", line 36, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'

[09/Aug/2016 10:30:13] "GET /FileHost/?fileName=Git-2.8.4-32-bit.exe HTTP/1.1" 2
00 8192
Traceback (most recent call last):
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 138, in run
self.finish_response()
  

[issue27682] Windows Error 10053, ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

2016-08-04 Thread Sushant

Sushant added the comment:

The CSV is around 75 MB, not that big I guess. And I've tried Chrome, Edge and 
Firefox

--

___
Python tracker 

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



[issue27682] Windows Error 10053, ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

2016-08-04 Thread Berker Peksag

Berker Peksag added the comment:

Which browser do you use? How big is the CSV file? Modern browsers tend to do 
aggressive prefetching so this might be the cause here.

--
nosy: +berker.peksag

___
Python tracker 

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



[issue27682] Windows Error 10053, ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

2016-08-04 Thread Sushant

Sushant added the comment:

Also, since I re-installed everything, I got python 3.5 too

--

___
Python tracker 

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



[issue27682] Windows Error 10053, ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

2016-08-04 Thread Sushant

Sushant added the comment:

There have been a few times when this code ran perfectly fine, without any 
errors whatsoever. 

So the structure is like this-

This code reads a csv, processes it and save it in a model-

class Endday(models.Model):
  company = models.TextField(null=True)
  eop = models.TextField(max_length=10) 

Now the database is postgresql, as soon as save is called, data is posted 
there. This code runs fine on my colleague's computer(same code) but he has 
windows 7. Thinking this might be a windows error, I re-installed windows 10 
from the scratch. But to no help. At last, I had to knock python's door.

--

___
Python tracker 

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



[issue27682] Windows Error 10053, ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

2016-08-04 Thread R. David Murray

R. David Murray added the comment:

If the save is happening twice, that must mean that that method is getting 
called twice, and I'm guessing that the second time it is called wsgiref is 
closed and thus you get the error.  But that's just a guess, your code snippet 
by itself isn't enough to see how everything fits together.

--

___
Python tracker 

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



[issue27682] Windows Error 10053, ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

2016-08-04 Thread Sushant

Sushant added the comment:

The code is actually quite simple, I'll post it over here-

def import_eop(request):
  with 
open('C:/Users/sg/Desktop/projects/drfapi/venv/drf/prices_companies_indices_transpose.csv')
 as f:
contents = f.readlines()
dates = contents[0]
dates = dates.split(",")
dates = dates[1:]
d = []
for i in range(len(dates)):
  d.append(Dates(date=dates[i]))
Dates.objects.bulk_create(d)
companies = []
entry = []
for i in range(1, len(contents)):
  csline = contents[i].split(",")
  prices = csline[1:len(csline)]
  company = csline[0]
  prices =[float(x) for x in prices]
  entry = (Endday(company=company, eop=prices))
  entry.save()
  f.close()
  print('Saved to database')
  return HttpResponse('Ok')


Now as you see, I'm not even handling wsgiref.close() at all. This isn't a 
django issue since django community themselves pointed me to this direction. 
Let me know if I can be of any help.

--
nosy: +SG

___
Python tracker 

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



[issue27682] Windows Error 10053, ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

2016-08-04 Thread R. David Murray

R. David Murray added the comment:

The traceback looks like wsgiref.close() was called before handle_error() was 
called (perhaps for a second time?)

We'll probably need a reproducer (as simple as possible please) to debug this 
further, which might be difficult since it may be tricky to simulate the 
windows error.  But you might also want to, say, post to python-list and see if 
anyone can spot a problem with your code.  Could it be that it is calling 
wsgiref.close at the wrong time?

--
nosy: +r.david.murray

___
Python tracker 

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



[issue27682] Windows Error 10053, ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

2016-08-04 Thread Sushant

Changes by Sushant :


--
nosy: +asvetlov, kristjan.jonsson, pje, steve.dower, tim.golden -SG

___
Python tracker 

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



[issue27682] Windows Error 10053, ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

2016-08-04 Thread Sushant

New submission from Sushant:

While saving, this error shows up and is whatever is saving gets saved twice-

Traceback (most recent call last):
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 
138, in run
self.finish_response()
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 
180, in finish_response
self.write(data)
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 
274, in write
self.send_headers()
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 
332, in send_headers
self.send_preamble()
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 
255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 
453, in _write
result = self.stdout.write(data)
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\socket.py", line 593, in 
write
return self._sock.send(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted 
by the software in your host machine
[04/Aug/2016 17:25:59] "GET /api/importeop/ HTTP/1.1" 500 59

Exception happened during processing of request from ('127.0.0.1', 51082)
Traceback (most recent call last):
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 
138, in run
self.finish_response()
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 
180, in finish_response
self.write(data)
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 
274, in write
self.send_headers()
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 
332, in send_headers
self.send_preamble()
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 
255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 
453, in _write
result = self.stdout.write(data)
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\socket.py", line 593, in 
write
return self._sock.send(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted 
by the software in your host machine

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 
141, in run
self.handle_error()
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\servers\basehttp.py",
 line 92, in handle_error
super(ServerHandler, self).handle_error()
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 
368, in handle_error
self.finish_response()
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 
180, in finish_response
self.write(data)
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 
274, in write
self.send_headers()
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 
331, in send_headers
if not self.origin_server or self.client_is_modern():
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 
344, in client_is_modern
return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py", line 
625, in process_request_thread
self.finish_request(request, client_address)
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py", line 
354, in finish_request
self.RequestHandlerClass(request, client_address, self)
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\servers\basehttp.py",
 line 99, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "C:\Users\Sushant 
Gahlot\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py", line 
681, in __init__
self.handle()
  File "C:\Users\Sushant