Since adding the StackImpact agent to a Tornado/asyncio application, we started seeing BufferError
s like this:
BufferError: Existing exports of data: object cannot be re-sized
File "tornado/web.py", line 1513, in _execute
self.finish()
File "tornado/web.py", line 991, in finish
self.flush(include_footers=True)
File "tornado/web.py", line 947, in flush
start_line, self._headers, chunk, callback=callback)
File "tornado/http1connection.py", line 400, in write_headers
self._pending_write = self.stream.write(data)
File "tornado/iostream.py", line 406, in write
self._handle_write()
File "tornado/iostream.py", line 872, in _handle_write
del self._write_buffer[:self._write_buffer_pos]
Our application runs inside a Docker container. We use:
import asyncio
from tornado.platform.asyncio import AsyncIOMainLoop
from tornado.httpserver import HTTPServer
from tornado.web import Application
if __name__ == '__main__':
AsyncIOMainLoop().install()
loop = asyncio.get_event_loop()
app = Application(...)
server = HTTPServer(app)
server.listen(8080)
internal_app = Application(...)
internal_server = HTTPServer(app)
internal_server.listen(8081)
loop.run_forever()
Cursory googling turned up the same error happening in the same place, as reported in this comment on a Tornado pull request. I don't know enough about Tornado's internals to guess at what's going on here but maybe @bdarnell can provide more insight.
In any case, I'm happy to provide more details as needed.