This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mattpr
Recipients mattpr, ned.deily, ronaldoussoren
Date 2017-09-29.16:19:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1506701944.65.0.213398074469.issue31639@psf.upfronthosting.co.za>
In-reply-to
Content
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 <module>
    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.1 - - [29/Sep/2017 18:04:38] "GET /domain1.html HTTP/1.1" 200 -
127.0.0.1 - - [29/Sep/2017 18:04:38] "GET /style.css HTTP/1.1" 200 -
127.0.0.1 - - [29/Sep/2017 18:04:39] "GET /domain2.html HTTP/1.1" 200 -
127.0.0.1 - - [29/Sep/2017 18:04:39] "GET /style.css HTTP/1.1" 200 -
^C
Keyboard interrupt received, exiting.
```

I can reproduce this EVERY time, but I can't imagine everyone has this issue or it would have been fixed already, so tried to provide lots of info about my environment.  Let me know if you need more.

There seems to be a similar issue on windows: https://github.com/Microsoft/BashOnWindows/issues/1906
History
Date User Action Args
2017-09-29 16:19:04mattprsetrecipients: + mattpr, ronaldoussoren, ned.deily
2017-09-29 16:19:04mattprsetmessageid: <1506701944.65.0.213398074469.issue31639@psf.upfronthosting.co.za>
2017-09-29 16:19:04mattprlinkissue31639 messages
2017-09-29 16:19:03mattprcreate