Closed anden-akkio closed 6 months ago
Found a temporary workaround for this by disabling the several pytest plugins that ddtrace injects. We don't care about them, just need ddtrace itself installed and running, so it's not a big deal. However, this will still need fixed for those that want to use Litestar and ddtrace's pytest
integration together, especially because this is the default behavior. I'd imagine most people that install them together will get confused and find this issue.
[tool.pytest.ini_options]
addopts = [
"-p no:ddtrace",
"-p no:ddtrace.pytest_bdd",
"-p no:ddtrace.pytest_benchmark"
]
This seems to be an issue with multidict and ddtrace, as it's multidict that's segfaulting here. @anden-akkio if this persists for you, I'd recommend opening an issue at their repo.
Description
We use
ddtrace
, Datadog's tracing library, in order to trace our code without much configuration needed. Getting this low-config tracing is extremely important to us, making this bug a blocker for us potentially switching from FastAPI to Litestar. We were hoping Litestar would have compatibility through their ASGI Integration.The combo mentioned in the title seems to cause a segfault when running
pytest
with a Litestar server. Seems like the two libraries are going back and forth to explore each file, then segfaulting for an unknown reason.Have confirmed that the issue does not occur if I remove
ddtrace
viapoetry remove ddtrace
then runpytest .
again. We're also successfully using ddtrace with FastAPI, so it's not a FastAPI thing either.URL to code causing the issue
https://github.com/anden-akkio/litestar-ddtrace-repro
MCVE
See above repo link for a full repro case.
Steps to reproduce
pyenv
if you haven't yetpyenv install
to install Python 3.10.12 as defined in the.python-version
filepython --version
to confirm you're on 3.10.12python -m pip install poetry
to install poetry, the package manager used in the repro casepython -m venv venv
to create virtual environmentsource venv/bin/activate
to activate virtual environmentpoetry install
to install deps frompoetry.lock
pytest .
to run testsScreenshots
N/A
Logs
Litestar Version
2.1.1
Running on M2 Mac, Apple Silicon. I mention because it's been a likely cause of segfaults in lots of machine learning code, so I wouldn't be surprised if that's the case here too.
Platform
Funding