Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I serve a movie file from development server(dev_appserver.py) of GAE Python?

I am trying to serve mp4/video in the GAE python development environment(using dev_appserver.py), but I was not able to play it on my browser so far.

Since 'Broken Pipe' error happened on the development server and I was able to play it on the production environment(on the google's server), the issue may be caused by browser's parallel requests. (If my understanding is correct, dev_appserver.py is single-threaded and cannot handle parallel requests.)

I tried '--disable-preconnect' option of Chrome, but it didn't solve the issue.

Are there any workarounds for it? Your advice is really appreciated.

Edit: The movie file is stored as a static resource, and I tried to access it directly (didn't use video tag).

[Version Information]

  • OS: Ubuntu 12.04 LTE
  • Browser: Chrome 19.0.1084.46, Firefox 12.0
  • GAE: Python - 1.6.5,
  • Python: 2.7.3

[Error Log]

    INFO     2012-05-21 07:35:04,575 dev_appserver.py:2891] "GET /static/test.mp4 HTTP/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 36240)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 310, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/home/chikashi/Development/google_appengine/google/appengine/tools/dev_appserver.py", line 2579, in __init__
    BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
  File "/usr/lib/python2.7/SocketServer.py", line 640, in __init__
    self.finish()
  File "/usr/lib/python2.7/SocketServer.py", line 693, in finish
    self.wfile.flush()
  File "/usr/lib/python2.7/socket.py", line 303, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
----------------------------------------
like image 940
Chikashi Kato Avatar asked Nov 13 '22 05:11

Chikashi Kato


1 Answers

Anything that's a very long operation (such as serving a movie) will tie up a thread until it completes. Since the development server is single-threaded, its only worker thread will have to wait until the download finishes before it can serve the next request.

In any case, the production App Engine environment doesn't have this problem and will happily serve your file, as long as it's not too large (I don't remember the limit).

You may also consider serving the movie file from another server. Depending on the bandwidth you use, there are cheaper hosting solutions than App Engine (even if none is as cool as theirs ;-) )

like image 161
rbanffy Avatar answered Dec 18 '22 12:12

rbanffy