New issue
Advanced search Search tips

Issue 738411 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner:
Closed: Jul 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug



Sign in to add a comment

Modules don't load correctly

Project Member Reported by neis@chromium.org, Jun 30 2017

Issue description

This is with tip of tree (35c62f099a6a22905b9205e31102b6daabad10de).

I'm running a local python http.server serving junk.html, junk.js and gunk.js as attached.

junk.html has an inline module script that imports junk.js, junk.js imports gunk.js. Each logs their filename to the console. That's it, very simple.

When I open junk.html in content_shell, everything works as expected. The http server outputs

127.0.0.1 - - [30/Jun/2017 13:22:12] "GET /junk.html HTTP/1.1" 200 -
127.0.0.1 - - [30/Jun/2017 13:22:12] "GET /junk.js HTTP/1.1" 200 -
127.0.0.1 - - [30/Jun/2017 13:22:12] "GET /gunk.js HTTP/1.1" 200 -

and content_shell outputs

[81760:81760:0630/132212.601696:1554395882842:INFO:CONSOLE(1)] "gunk.js", source: http://localhost:8000/gunk.js (1)
[81760:81760:0630/132212.601854:1554395882995:INFO:CONSOLE(2)] "junk.js", source: http://localhost:8000/junk.js (2)
[81760:81760:0630/132212.601950:1554395883090:INFO:CONSOLE(7)] "junk.html", source: http://localhost:8000/junk.html (7)

Then I press reload. http server outputs

127.0.0.1 - - [30/Jun/2017 13:22:29] "GET /junk.html HTTP/1.1" 200 -

and content_shell outputs

[81760:81760:0630/132229.696219:1554412977367:INFO:CONSOLE(1)] "gunk.js", source: http://localhost:8000/gunk.js (1)
[81760:81760:0630/132229.696401:1554412977542:INFO:CONSOLE(2)] "junk.js", source: http://localhost:8000/junk.js (2)
[81760:81760:0630/132229.696499:1554412977639:INFO:CONSOLE(7)] "junk.html", source: http://localhost:8000/junk.html (7)

(the js file probably were cached)

I press reload again

127.0.0.1 - - [30/Jun/2017 13:22:44] "GET /junk.html HTTP/1.1" 200 -
127.0.0.1 - - [30/Jun/2017 13:22:44] "GET /junk.js HTTP/1.1" 200 -
127.0.0.1 - - [30/Jun/2017 13:22:44] "GET /gunk.js HTTP/1.1" 200 -

[81760:81760:0630/132244.328248:1554427609393:INFO:CONSOLE(1)] "gunk.js", source: http://localhost:8000/gunk.js (1)
[81760:81760:0630/132244.328372:1554427609513:INFO:CONSOLE(2)] "junk.js", source: http://localhost:8000/junk.js (2)
[81760:81760:0630/132244.328471:1554427609611:INFO:CONSOLE(7)] "junk.html", source: http://localhost:8000/junk.html (7)

And so on.


But when I open it in chrome, strange things happen.

Right away, on first load, the http server outputs

127.0.0.1 - - [30/Jun/2017 13:25:50] "GET /junk.html HTTP/1.1" 200 -

and the page load hangs indefinitely (I see the "X" next to the address bar and the moving circle next to the tab header).

Then I open Devtools/Network, the console drawer as well, and press reload. The http server outputs

127.0.0.1 - - [30/Jun/2017 13:27:27] "GET /junk.js HTTP/1.1" 200 -
127.0.0.1 - - [30/Jun/2017 13:27:27] "GET /junk.html HTTP/1.1" 200 -

and Devtools Network panel shows these two files with status 200 but gunk.js with status "pending". There is no console output. The page load hangs like before.

I press reload again. Now I get:

127.0.0.1 - - [30/Jun/2017 13:30:57] "GET /gunk.js HTTP/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 55566)
Traceback (most recent call last):
  File "/usr/lib/python3.4/socketserver.py", line 305, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python3.4/socketserver.py", line 331, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python3.4/socketserver.py", line 344, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.4/socketserver.py", line 673, in __init__
    self.handle()
  File "/usr/lib/python3.4/http/server.py", line 398, in handle
    self.handle_one_request()
  File "/usr/lib/python3.4/http/server.py", line 386, in handle_one_request
    method()
  File "/usr/lib/python3.4/http/server.py", line 680, in do_GET
    self.copyfile(f, self.wfile)
  File "/usr/lib/python3.4/http/server.py", line 839, in copyfile
    shutil.copyfileobj(source, outputfile)
  File "/usr/lib/python3.4/shutil.py", line 70, in copyfileobj
    fdst.write(buf)
  File "/usr/lib/python3.4/socket.py", line 394, in write
    return self._sock.send(b)
BrokenPipeError: [Errno 32] Broken pipe
----------------------------------------
127.0.0.1 - - [30/Jun/2017 13:30:57] "GET /gunk.js HTTP/1.1" 200 -
127.0.0.1 - - [30/Jun/2017 13:30:57] "GET /junk.html HTTP/1.1" 200 -

Devtools now shows only two files, junk.html with status 200 and junk.js with status "pending". Again the page load hangs and there is no console output. And so on... Sometimes I was able to get the correct behavior after reloading a couple times but only for that one load, and at the moment I can't even get it once.

I'm running chrome as follows:
out/Release/chrome --user-data-dir=$(mktemp -d) --no-first-run --enable-blink-features=ModuleScripts 'http://localhost:8000/junk.html'

Analogous for content_shell.
 
junk.html
124 bytes View Download
junk.js
44 bytes View Download
gunk.js
24 bytes View Download

Comment 1 by neis@chromium.org, Jul 3 2017

I'm unable to reproduce this with other web servers (apache, webfs).
Owner: kouhei@chromium.org
Status: WontFix (was: Available)
SimpleHTTPServer doesn't support concurrent request handling, and this doesn't play well w/ Chrome preconnect (which seems disabled in content_shell).

You can repro this w/o using Chrome by following:
$ python -m SimpleHTTPServer 8020 & # launch httpd
$ telnet 127.0.0.1 8020 & # <- create a hanging connection to SimpleHTTPServer
$ curl http://127.0.0.1:8020/test.js # <- create another conn to the server to request test.js, but this just hangs SimpleHTTPServer from responding.

This shouldn't happen in real world, as deploying such server in www means anyone can effectively stop the server from serving response to others.

Comment 3 by neis@google.com, Jul 4 2017

Thank you for the investigation!

Comment 4 by adamk@chromium.org, Aug 30 2017

I just got a report from a Polymer team member who ran into this. Perhaps we should put up an explanation somewhere?

Comment 5 by n...@chromium.org, Sep 8 2017

@kouhei: Soooo what's the plan going forward? I understand that this is a SimpleHTTPServer problem, but it's the most popular local server, and the fact that it doesn't work _at all_ with Chrome and modules is pretty bad. My only alternative right now to develop apps that use modules is to use Safari (since I don't have any servers installed). 

Sign in to add a comment