DataDog / dd-trace-py

Datadog Python APM Client
https://ddtrace.readthedocs.io/
Other
536 stars 408 forks source link

ValueError: '/usr/local/bin/cygdb' does not start with '/usr/local/lib/python3.8/site-packages' #7754

Closed magzim21 closed 9 months ago

magzim21 commented 10 months ago

Summary of problem

Trying to instrument python Luigi

pip freeze

aiobotocore==2.5.4
aiohttp==3.9.0
aioitertools==0.11.0
aiosignal==1.3.1
alembic==1.12.0
appdirs==1.4.4
async-timeout==4.0.3
attrs==23.1.0
black==23.7.0
blinker==1.7.0
boto3==1.28.17
botocore==1.31.17
bytecode==0.15.1
cattrs==23.2.2
certifi==2023.7.22
cffi==1.16.0
cfgv==3.4.0
chardet==5.1.0
charset-normalizer==3.3.2
click==8.1.7
ConfigArgParse==1.5.3
coverage==7.3.2
cryptography==41.0.5
Cython==0.29.36
datadog==0.45.0
ddsketch==2.0.4
ddtrace==2.3.0
debugpy==1.8.0
decorator==5.1.1
deltalake==0.10.0
Deprecated==1.2.14
distlib==0.3.7
docutils==0.20.1
dpath==2.1.6
duckdb==0.8.1
envier==0.4.0
exceptiongroup==1.2.0
filelock==3.13.1
flake8==3.8.4
flask==2.3.3
Flask-SQLAlchemy==2.5.1
freezegun==1.2.2
frozenlist==1.4.0
fsspec==2023.9.2
glob2==0.7
greenlet==3.0.1
identify==2.5.22
idna==3.4
importlib-metadata==6.8.0
importlib-resources==6.1.1
iniconfig==2.0.0
ipython-genutils==0.2.0
itsdangerous==2.1.2
Jinja2==3.1.2
jmespath==1.0.1
jsonschema==4.17.3
lockfile==0.12.2
luigi==3.4.0
Mako==1.3.0
MarkupSafe==2.1.3
mccabe==0.6.1
moto==4.2.4
multidict==6.0.4
mypy-extensions==1.0.0
networkx==3.1
nodeenv==1.8.0
numpy==1.24.3
opentelemetry-api==1.21.0
packaging==23.2
pandas==1.5.3
parse==1.19.1
parse-type==0.6.2
pathspec==0.11.2
pkgutil-resolve-name==1.3.10
platformdirs==4.0.0
pluggy==1.3.0
pre-commit==2.20.0
protobuf==4.25.1
psutil==5.9.5
psycopg2-binary==2.9.7
py==1.11.0
py-partiql-parser==0.3.7
pyarrow==13.0.0
pycodestyle==2.6.0
pycparser==2.21
pyflakes==2.2.0
pyhamcrest==2.0.4
pyparsing==3.1.1
pyrsistent==0.19.3
pytest==7.3.1
pytest-bdd==5.0.0
pytest-cov==4.1.0
pytest-flask-sqlalchemy==1.1.0
pytest-html==3.2.0
pytest-metadata==3.0.0
pytest-mock==3.11.1
pytest-timeout==2.1.0
python-daemon==3.0.1
python-dateutil==2.8.2
python-dotenv==1.0.0
python-json-logger==2.0.7
pytz==2023.3
PyYAML==6.0
ratelimiter==1.2.0.post0
requests==2.31.0
responses==0.24.1
s3fs==2023.9.2
s3transfer==0.6.2
six==1.16.0
SQLAlchemy==1.4.45
tenacity==8.2.3
toml==0.10.2
tomli==2.0.1
toposort==1.10
tornado==6.3.3
traitlets==5.9.0
typing-extensions==4.8.0
urllib3==1.26.18
virtualenv==20.24.7
werkzeug==3.0.1
wrapt==1.15.0
xmltodict==0.13.0
yarl==1.9.3
zipp==3.15.0

Error (asked to report)

Unable to build package file mapping, please report this to https://github.com/DataDog/dd-trace-py/issues
Traceback (most recent call last):
  File "/usr/local/lib64/python3.8/site-packages/ddtrace/internal/utils/cache.py", line 118, in _
    retval, exc = f.__callonce_result__  # type: ignore[attr-defined]
AttributeError: 'function' object has no attribute '__callonce_result__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib64/python3.8/site-packages/ddtrace/internal/packages.py", line 106, in _package_file_mapping
    if ilmd_d is not None and ilmd_d.files is not None:
  File "/usr/local/lib/python3.8/site-packages/importlib_metadata/__init__.py", line 511, in files
    return skip_missing_files(
  File "/usr/local/lib/python3.8/site-packages/importlib_metadata/_functools.py", line 102, in wrapper
    return func(param, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/importlib_metadata/__init__.py", line 509, in skip_missing_files
    return list(filter(lambda path: path.locate().exists(), package_paths))
  File "/usr/local/lib/python3.8/site-packages/importlib_metadata/__init__.py", line 546, in <genexpr>
    (subdir / name)
  File "/usr/lib64/python3.8/pathlib.py", line 908, in relative_to
    raise ValueError("{!r} does not start with {!r}"
ValueError: '/usr/local/bin/cygdb' does not start with '/usr/local/lib/python3.8/site-packages'
{"asctime": "2023-11-24+23:18:17", "levelname": "ERROR", "message": "Unable to build package file mapping, please report this to https://github.com/DataDog/dd-trace-py/issues", "exc_info": "Traceback (most recent call last):\n  File \"/usr/local/lib64/python3.8/site-packages/ddtrace/internal/utils/cache.py\", line 118, in _\n    retval, exc = f.__callonce_result__  # type: ignore[attr-defined]\nAttributeError: 'function' object has no attribute '__callonce_result__'\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/usr/local/lib64/python3.8/site-packages/ddtrace/internal/packages.py\", line 106, in _package_file_mapping\n    if ilmd_d is not None and ilmd_d.files is not None:\n  File \"/usr/local/lib/python3.8/site-packages/importlib_metadata/__init__.py\", line 511, in files\n    return skip_missing_files(\n  File \"/usr/local/lib/python3.8/site-packages/importlib_metadata/_functools.py\", line 102, in wrapper\n    return func(param, *args, **kwargs)\n  File \"/usr/local/lib/python3.8/site-packages/importlib_metadata/__init__.py\", line 509, in skip_missing_files\n    return list(filter(lambda path: path.locate().exists(), package_paths))\n  File \"/usr/local/lib/python3.8/site-packages/importlib_metadata/__init__.py\", line 546, in <genexpr>\n    (subdir / name)\n  File \"/usr/lib64/python3.8/pathlib.py\", line 908, in relative_to\n    raise ValueError(\"{!r} does not start with {!r}\"\nValueError: '/usr/local/bin/cygdb' does not start with '/usr/local/lib/python3.8/site-packages'", "logger": "ddtrace.internal.packages"}
emmettbutler commented 9 months ago

Thanks for reporting this issue, @magzim21. How can we replicate it on our own machines?

A workaround you could try is setting the environment variable DD_PROFILING_ENABLED=0.

magzim21 commented 9 months ago

But I want profiling. I changed a base image recently - that might resolved the issue. I will keep updated.

magzim21 commented 9 months ago

I do not have this issue after removing C libraries I did not understand