Skip to content
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

opentelemetry-instrumentation-tornado: Unhandled exception in _finish_tracing_callback #2555

Closed
jgibo opened this issue May 27, 2024 · 3 comments · Fixed by #2563
Closed
Labels
bug Something isn't working

Comments

@jgibo
Copy link
Contributor

jgibo commented May 27, 2024

Describe your environment Describe any aspect of your environment relevant to the problem, including your Python version, platform, version numbers of installed dependencies, information about your cloud hosting provider, etc. If you're reporting a problem with a specific version of a library in this repo, please check whether the problem has been fixed on main.

No environmental factors - originally occurred in production (Linux VM, python 3.11), and reproduced locally on MacOS python3.11.

future.result() in _finish_tracing_callback throws an exception if the future result is an exception. This is expected behaviour for the future api, but based on how the code is structured, this appears to not be desired here.

The impact is the unhandled exception bubbles up to the asyncio runtime where it's logged. Which is undesired as this may be an error that the app normally expects and handles without logging.

Steps to reproduce

  • Using tornado http client, make a request that causes the client to return a future containing an exception (response of 404, 500, etc...)

What is the expected behavior?

  • _finish_tracing_callback gracefully handles a future with an exception result

What is the actual behavior?

  • When _finish_tracing_callback reads a future with an exception result, it throws an exception that is ultimately unhandled by the lib, causing it to bubble up to the asyncio runtime.
@jgibo jgibo added the bug Something isn't working label May 27, 2024
@jgibo
Copy link
Contributor Author

jgibo commented May 27, 2024

Attempted fix here main...jgibo:opentelemetry-python-contrib:issue_2555

Note: May move the fork to my company org instead of my personal account, will raise a PR once that is resolved.

@xrmx
Copy link
Contributor

xrmx commented May 27, 2024

@jgibo thanks! please also add a test to avoid regressions.

@jgibo
Copy link
Contributor Author

jgibo commented May 29, 2024

Tests added and PR raised

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants