Skip to content

Instantly share code, notes, and snippets.

@zhammer
Last active May 29, 2020 14:22
Show Gist options
  • Save zhammer/f0322695167ced73124b2504934171df to your computer and use it in GitHub Desktop.
Save zhammer/f0322695167ced73124b2504934171df to your computer and use it in GitHub Desktop.
dd-trace-py RuntimeWorker daemon bug repro
from __future__ import print_function
import logging
import ddtrace
# disable "ERROR [ddtrace.internal.writer] [writer.py:270] - Failed to send traces to Datadog Agent at http://localhost:8126"
logging.getLogger("ddtrace.internal.writer").setLevel(logging.CRITICAL)
def main():
with ddtrace.tracer.trace("app-main"):
print("hello world")
if __name__ == "__main__":
main()
version: '3'
services:
app:
image: python:2
volumes:
- .:/project
working_dir: /project
environment:
DD_AGENT_HOST: localhost # doesn't actually exist
DD_RUNTIME_METRICS_ENABLED: "True"
command: >
bash -c "
pip install ddtrace==0.38.0 &&
while true
do
ddtrace-run python app.py
done
"
app_1 | Exception in thread RuntimeWorker (most likely raised during interpreter shutdown):
app_1 | Traceback (most recent call last):
app_1 | File "/usr/local/lib/python2.7/threading.py", line 801, in __bootstrap_inner
app_1 | File "/usr/local/lib/python2.7/threading.py", line 754, in run
app_1 | File "/usr/local/lib/python2.7/site-packages/ddtrace/_worker.py", line 70, in _target
app_1 | File "/usr/local/lib/python2.7/site-packages/ddtrace/_worker.py", line 79, in _on_shutdown
app_1 | File "/usr/local/lib/python2.7/site-packages/ddtrace/internal/runtime/runtime_metrics.py", line 68, in flush
app_1 | File "/usr/local/lib/python2.7/site-packages/ddtrace/vendor/dogstatsd/base.py", line 131, in __exit__
app_1 | File "/usr/local/lib/python2.7/site-packages/ddtrace/vendor/dogstatsd/base.py", line 191, in close_buffer
app_1 | File "/usr/local/lib/python2.7/site-packages/ddtrace/vendor/dogstatsd/base.py", line 344, in _flush_buffer
app_1 | File "/usr/local/lib/python2.7/site-packages/ddtrace/vendor/dogstatsd/base.py", line 328, in _send_to_server
app_1 | <type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'timeout'
@zhammer
Copy link
Author

zhammer commented May 27, 2020

if you run docker-compose up for long enough you'll see an error like error-captured.out eventually. there are also some of these exceptions <type 'exceptions.ValueError'>: list.remove(x): x not in list but i'm not sure if that's the same issue or possibly caused by super short lifetime of app.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment