[issue31639] http.server and SimpleHTTPServer hang after a few requests

2017-09-29 Thread Matt Pr

New submission from Matt Pr :

Doing a cross domain iframe test.  `domain1.html` has iframe pointing at 
`domain2.html` which has iframe pointing at `domain3.html`.

`domain{1,2,3}.com` are all configured to point at `127.0.0.1` in my 
`/etc/hosts` file.

Loaded up `http://domain1.com:8000/domain1.html` in my browser and it spins 
waiting for domain3 to load.  CTRL-C and then domain3 loads.  CTRL-C again to 
quit.

Google chrome: 61.0.3163.100 (Official Build) (64-bit)

```
$ python --version
Python 2.7.13
$ uname -a
Darwin [hostname-removed] 14.5.0 Darwin Kernel Version 14.5.0: Sun Jun  4 
21:40:08 PDT 2017; root:xnu-2782.70.3~1/RELEASE_X86_64 x86_64
$ brew info python
...
/usr/local/Cellar/python/2.7.13 (3,571 files, 49MB) *
  Poured from bottle on 2017-01-30 at 16:56:40
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/python.rb
```

```
$ python -m SimpleHTTPServer 8000
Serving HTTP on 0.0.0.0 port 8000 ...
127.0.0.1 - - [29/Sep/2017 17:14:22] "GET /domain1.html HTTP/1.1" 200 -
127.0.0.1 - - [29/Sep/2017 17:14:22] "GET /style.css HTTP/1.1" 200 -
127.0.0.1 - - [29/Sep/2017 17:14:23] "GET /domain2.html HTTP/1.1" 200 -
127.0.0.1 - - [29/Sep/2017 17:14:23] "GET /style.css HTTP/1.1" 200 -
^C
Exception happened during processing of request from ('127.0.0.1', 64315)
Traceback (most recent call last):
  File 
"/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py",
 line 290, in _handle_request_noblock
self.process_request(request, client_address)
  File 
"/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py",
 line 318, in process_request
self.finish_request(request, client_address)
  File 
"/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py",
 line 331, in finish_request
self.RequestHandlerClass(request, client_address, self)
  File 
"/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py",
 line 652, in __init__
self.handle()
  File 
"/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py",
 line 340, in handle
self.handle_one_request()
  File 
"/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py",
 line 310, in handle_one_request
self.raw_requestline = self.rfile.readline(65537)
  File 
"/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py",
 line 480, in readline
data = self._sock.recv(self._rbufsize)
KeyboardInterrupt

127.0.0.1 - - [29/Sep/2017 17:14:26] "GET /domain3.html HTTP/1.1" 200 -
127.0.0.1 - - [29/Sep/2017 17:14:26] "GET /style.css HTTP/1.1" 200 -
^CTraceback (most recent call last):
  File 
"/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py",
 line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
  File 
"/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py",
 line 72, in _run_code
exec code in run_globals
  File 
"/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SimpleHTTPServer.py",
 line 235, in 
test()
  File 
"/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SimpleHTTPServer.py",
 line 231, in test
BaseHTTPServer.test(HandlerClass, ServerClass)
  File 
"/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py",
 line 610, in test
httpd.serve_forever()
  File 
"/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py",
 line 231, in serve_forever
poll_interval)
  File 
"/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py",
 line 150, in _eintr_retry
return func(*args)
KeyboardInterrupt
```


Same issue with python3
```
$ python3 --version
Python 3.6.0
$ brew info python3
...
/usr/local/Cellar/python3/3.6.0 (3,611 files, 55.9MB) *
  Poured from bottle on 2017-01-30 at 16:57:16
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/python3.rb
```

Note only one CTRL-C to exit... but note it didn't server domain3.html...so 
stuck in the same place as before.  With python2 it serves domain3.html after 
hitting the first CTRL-C.  With python3 it never serves it, just quits after 
the CTRL-C and browser is "spinning" waiting for the file.
```
$ python3 -m http.server 8000
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
127.0.0

[issue31639] http.server and SimpleHTTPServer hang after a few requests

2017-09-29 Thread Matt Pr

Matt Pr  added the comment:

It has been pointed out to me that this issue may be related to chrome making 
multiple requests in parallel.

A test with wget seems to support this.

wget -E -H -k -K -p http://domain1.com:8000/domain1.html

...does not hang, whereas requests from chrome do hang.

On some level I guess I wonder about the usefulness of simple web servers if 
they choke on very basic website requests from modern browsers.

--

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



[issue11874] argparse assertion failure with brackets in metavars

2016-03-21 Thread Matt Pr

Matt Pr added the comment:

Same AssertionError is also caused by having certain "choices".

Python 2.7.10

global_options.add_argument('--field-sep', choices=[',',';','|','\t'], 
required=True, help='Field separator that separates columns in a row.')

Removing required=True or removing the tab (\t) from the options both work 
around this usage formatter issue for me.

I know this is an old issue but figured I would add another repro case to help 
whoever might work on this.

--
nosy: +mattpr

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