-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BufferError with Tornado and asyncio #1
Comments
Thanks for submitting the issue with the detailed info! I've tried with a simple asyncio/tornado app, based on the code you provided, running for some time under high load. I get no errors and the agent reports everything it supposed to. Is there any specific functionality in your app, which you think might be related and I need to try to reproduce? Any other modules? One thing to try, if possible in your case, is to disable memory profiler by passing Please note, we haven't yet worked on a full support of asyncio (only gevent). Especially time and server profilers might be affected. |
I deployed a build of our app earlier this morning with Our app is fairly complex with many 3rd-party modules but it's hard for me to say whether any of them might be contributing. From our
Most of the app is asynchronous. It communicates with clients via REST and WebSocket. We use asyncio-native libraries to interface with upstream services where possible (AWS via import asyncio
from neo4j.v1 import GraphDatabase
class Neo4j:
_driver = None
@classmethod
def get_driver(cls):
if cls._driver is None:
cls._driver = GraphDatabase.driver(...)
return cls._driver
async def run(cls, statement, *args, **kwargs):
driver = cls.get_driver()
def run():
cls.pending_metric.inc()
start = time()
with driver.session() as session:
result = session.run(statement, *args, **kwargs)
latency = time() - start
cls.pending_metric.dec()
cls.latency_metric.observe(latency)
return result
loop = asyncio.get_event_loop()
# Passing None uses the default executor
return await loop.run_in_executor(None, run) Apart from the above (which has never given us trouble), we had no other use of threading in the app prior to adding the StackImpact agent. |
I was able to reproduce the issue, with and without the agent. What happens is that if we do Cleaning up local variables explicitly in signal handler fixes the problem. The fix is released in agent v1.0.3. |
Awesome, thank you! I'll try it out again today or Monday and report back. |
Problem
Since adding the StackImpact agent to a Tornado/asyncio application, we started seeing
BufferError
s like this:Environment
Our application runs inside a Docker container. We use:
tornado
4.5.1stackimpact
1.0.0We start it like this (simplified for brevity):
Notes
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.
The text was updated successfully, but these errors were encountered: