Tornado concurrency limited to 6 connections?
<p>I have the following "dummy server" running:</p>

<pre><code>import tornado.web
from tornado.ioloop import IOLoop
from tornado import gen 
import time

@gen.coroutine
def async_sleep(seconds):
    yield gen.Task(IOLoop.instance().add_timeout, time.time() + seconds)

class TestHandler(tornado.web.RequestHandler):

    reqnum = 0

    @gen.coroutine
    def get(self):
        reqnum = TestHandler.reqnum
        TestHandler.reqnum += 1
        for i in range(100):
            print(reqnum,end='')
            if reqnum == 0 : print()
            yield async_sleep(1)
        self.write(str(reqnum))
        self.finish()

if __name__ == '__main__' :

    application = tornado.web.Application([
        (r"/test", TestHandler),
        ])  

    application.listen(9999)
    IOLoop.instance().start()
</code></pre>

<p>So this should run fine for tons of concurrent connections, you'd think... But it doesn't. Starting the server and opening 16 tabs to it, you get:</p>

<pre><code>0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
120
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
314520
</code></pre>

<p>Which is pretty perplexing. What's weirder still is that the correct result is printed on all tabs, 0-15. That's <em>all</em> the output to the console, though. No more arrived.</p>

<p>What the heck is happening?</p>