Discussion:
Bottle hang on Windows with IE10+
Dave
2014-02-12 00:30:11 UTC
Permalink
Hi Bottle folks,

I'm using Bottle on Windows with Python 2.6 or 2.7 (I tried both). I also
tried Bottle versions 11.6 and 12.3.

If I set up a very simple bottle server, and then go to it in IE 10 or 11,
then it sometimes hangs. If I then refresh the page, I get this exception:

----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 58390)
Traceback (most recent call last):
File "c:\Python27\Lib\SocketServer.py", line 295, in
_handle_request_noblock
self.process_request(request, client_address)
File "c:\Python27\Lib\SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "c:\Python27\Lib\SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "c:\Python27\Lib\SocketServer.py", line 649, in __init__
self.handle()
File "c:\Python27\Lib\wsgiref\simple_server.py", line 116, in handle
self.raw_requestline = self.rfile.readline()
File "c:\Python27\Lib\socket.py", line 447, in readline
data = self._sock.recv(self._rbufsize)
error: [Errno 10054] An existing connection was forcibly closed by the
remote host
----------------------------------------

By "Hang" I mean it never responds to the request, and other requests are
also not serviced. After I get the exception, Bottle returns to normal
behavior.

Here's my source code:

from bottle import Bottle, run

app = Bottle()

@app.route('/')
def asdf():
return "asdf"

run(app, host='0.0.0.0', port=8090)

If I clear the cache, then refresh, it makes the hang much more likely
(maybe 1/3 of all requests cause the hang). If I don't clear the cache,
then it almost never hangs. You can elicit the behavior by using
"InPrivate" mode in IE, or by clearing "Temporary Internet files" with
ctrl+shift+delete. However, if I just f5 or ctrl+f5, then it never hangs.

I have never seen the hang with Chrome or FF. It doesn't happen if the
server is in Linux. It happens whether the server is on localhost or
across the network.

Any ideas?

Thanks,
Dave
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.

---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Shola Smith
2014-02-13 18:14:22 UTC
Permalink
I guess you should start with the simplest example from their site to know
where the problem is coming from.
Post by Dave
Hi Bottle folks,
I'm using Bottle on Windows with Python 2.6 or 2.7 (I tried both). I also
tried Bottle versions 11.6 and 12.3.
If I set up a very simple bottle server, and then go to it in IE 10 or 11,
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 58390)
File "c:\Python27\Lib\SocketServer.py", line 295, in
_handle_request_noblock
self.process_request(request, client_address)
File "c:\Python27\Lib\SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "c:\Python27\Lib\SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "c:\Python27\Lib\SocketServer.py", line 649, in __init__
self.handle()
File "c:\Python27\Lib\wsgiref\simple_server.py", line 116, in handle
self.raw_requestline = self.rfile.readline()
File "c:\Python27\Lib\socket.py", line 447, in readline
data = self._sock.recv(self._rbufsize)
error: [Errno 10054] An existing connection was forcibly closed by the
remote host
----------------------------------------
By "Hang" I mean it never responds to the request, and other requests are
also not serviced. After I get the exception, Bottle returns to normal
behavior.
from bottle import Bottle, run
app = Bottle()
@app.route('/')
return "asdf"
run(app, host='0.0.0.0', port=8090)
If I clear the cache, then refresh, it makes the hang much more likely
(maybe 1/3 of all requests cause the hang). If I don't clear the cache,
then it almost never hangs. You can elicit the behavior by using
"InPrivate" mode in IE, or by clearing "Temporary Internet files" with
ctrl+shift+delete. However, if I just f5 or ctrl+f5, then it never hangs.
I have never seen the hang with Chrome or FF. It doesn't happen if the
server is in Linux. It happens whether the server is on localhost or
across the network.
Any ideas?
Thanks,
Dave
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.

---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Dave
2014-02-13 23:00:36 UTC
Permalink
I did. That's where I got the source code I listed.
Post by Shola Smith
I guess you should start with the simplest example from their site to know
where the problem is coming from.
Post by Dave
Hi Bottle folks,
I'm using Bottle on Windows with Python 2.6 or 2.7 (I tried both). I
also tried Bottle versions 11.6 and 12.3.
If I set up a very simple bottle server, and then go to it in IE 10 or
11, then it sometimes hangs. If I then refresh the page, I get this
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 58390)
File "c:\Python27\Lib\SocketServer.py", line 295, in
_handle_request_noblock
self.process_request(request, client_address)
File "c:\Python27\Lib\SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "c:\Python27\Lib\SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "c:\Python27\Lib\SocketServer.py", line 649, in __init__
self.handle()
File "c:\Python27\Lib\wsgiref\simple_server.py", line 116, in handle
self.raw_requestline = self.rfile.readline()
File "c:\Python27\Lib\socket.py", line 447, in readline
data = self._sock.recv(self._rbufsize)
error: [Errno 10054] An existing connection was forcibly closed by the
remote host
----------------------------------------
By "Hang" I mean it never responds to the request, and other requests are
also not serviced. After I get the exception, Bottle returns to normal
behavior.
from bottle import Bottle, run
app = Bottle()
@app.route('/')
return "asdf"
run(app, host='0.0.0.0', port=8090)
If I clear the cache, then refresh, it makes the hang much more likely
(maybe 1/3 of all requests cause the hang). If I don't clear the cache,
then it almost never hangs. You can elicit the behavior by using
"InPrivate" mode in IE, or by clearing "Temporary Internet files" with
ctrl+shift+delete. However, if I just f5 or ctrl+f5, then it never hangs.
I have never seen the hang with Chrome or FF. It doesn't happen if the
server is in Linux. It happens whether the server is on localhost or
across the network.
Any ideas?
Thanks,
Dave
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.

---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
James Preston
2014-08-13 11:18:18 UTC
Permalink
Hi, I see this exact behaviour.

I'm working in a large intranet environment where the PHBs mandate IE10, so this really is an annoying issue during development.

ProcessExplorer shows python.exe is blocked in a socket recv, but beyond that there is very little info available. Could it be a keep-alive issue?

James

--
James Preston
2014-08-13 13:26:36 UTC
Permalink
Okay, after playing with this for a while, I'm willing to blame the combination of the inbuilt wsgiref in Python (2.7.1 in my case ... don't ask) and IE10.

Even the trivial sample app embedded in the wsgiref source fails in a similar way. My work around is to give up on wsgiref and grab CherryPy.
unzip CherryPi*
set PYTHONPATH=CherryPy-3.2.4
then add ', server="cherrypy"' to the runner per the bottlepy docs.

With this done, I've reloaded hundreds of pages on my toy Bottle app and haven't seen the hang again once, whereas before it would die every five or so refreshes. Shame about breaking the "everything in one file" rule.

Hope this helps!


James

--
'Yassine Chaouche' via bottlepy
2015-05-01 10:49:06 UTC
Permalink
Had the same issue here, although not exactly the same traceback. Indeed the problem lies in WSGIServer which is monothread by default, I don't know why, even though the standard library offers two mixin classes that enable any webserver (that derives from the BaseHTTPServer class) to handle requests in parallel (in multiple threads or multiple processes).

I described my debugging process and my findings in this page : http://ychaouche.wikispot.org/HowBottleAppsWork

Yassine.
Post by Dave
Hi Bottle folks,
I'm using Bottle on Windows with Python 2.6 or 2.7 (I tried both). I also
tried Bottle versions 11.6 and 12.3.
If I set up a very simple bottle server, and then go to it in IE 10 or 11,
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 58390)
File "c:\Python27\Lib\SocketServer.py", line 295, in
_handle_request_noblock
self.process_request(request, client_address)
File "c:\Python27\Lib\SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "c:\Python27\Lib\SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "c:\Python27\Lib\SocketServer.py", line 649, in __init__
self.handle()
File "c:\Python27\Lib\wsgiref\simple_server.py", line 116, in handle
self.raw_requestline = self.rfile.readline()
File "c:\Python27\Lib\socket.py", line 447, in readline
data = self._sock.recv(self._rbufsize)
error: [Errno 10054] An existing connection was forcibly closed by the
remote host
----------------------------------------
By "Hang" I mean it never responds to the request, and other requests are
also not serviced. After I get the exception, Bottle returns to normal
behavior.
from bottle import Bottle, run
app = Bottle()
@app.route('/')
return "asdf"
run(app, host='0.0.0.0', port=8090)
If I clear the cache, then refresh, it makes the hang much more likely
(maybe 1/3 of all requests cause the hang). If I don't clear the cache,
then it almost never hangs. You can elicit the behavior by using
"InPrivate" mode in IE, or by clearing "Temporary Internet files" with
ctrl+shift+delete. However, if I just f5 or ctrl+f5, then it never hangs.
I have never seen the hang with Chrome or FF. It doesn't happen if the
server is in Linux. It happens whether the server is on localhost or
across the network.
Any ideas?
Thanks,
Dave
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.

---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...