dd-trace-py icon indicating copy to clipboard operation
dd-trace-py copied to clipboard

[BUG]: builtins.FileNotFoundError: [Errno 2] No such file or directory: 'ld'

Open JamesHarrison opened this issue 4 months ago • 2 comments

Tracer Version(s)

3.15.0

Python Version(s)

3.12

Pip Version(s)

n/a (poetry)

Bug Report

ddtrace appears to try and call the ld program and this will fail in many environments.

This throws an exception (which is then coming up in Datadog itself).

Has appeared somewhere between 3.8 and 3.15, we started seeing this after a 3.15 update.

Reproduction Code

No response

Error Logs

Traceback (most recent call last):
  File "/app/.venv/lib/python3.12/site-packages/ddtrace/contrib/internal/subprocess/patch.py", line 587, in _traced_subprocess_init
    return wrapped(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.12/subprocess.py", line 1955, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ld'

Libraries in Use

No response

Operating System

Python 3.12-slim Docker image

JamesHarrison avatar Sep 29 '25 16:09 JamesHarrison

I've also seen lsb_release in the same backtrace.

JamesHarrison avatar Sep 29 '25 16:09 JamesHarrison

Hi @JamesHarrison,

Thanks for opening this issue. The subprocess integration is primarily an instrumentation wrapper that monitors subprocess calls made by your application. It patches Python's subprocess and os functions to trace security-relevant executions when ASM or IAST is enabled.

If ld is being called, it's most likely coming from your application code or a third-party library you're using.

You can disable the subprocess integration by setting the following environment variable: DD_TRACE_SUBPROCESS_ENABLED=False.

Could you please open a support request here? This will help us gather additional telemetry about your setup. To debug further we will need a reproduction.

mabdinur avatar Oct 10 '25 21:10 mabdinur