Skip to content

Python autoinstrumentation fails with "__sched_cpufree: symbol not found" under Alpine 3.18 #1968

@alexflint

Description

@alexflint

Describe your environment

Python 3.10
Alpine Linux 3/18
Kubernetes 1.25
opentelemetry-operator-0.37.1 0.83.0

Steps to reproduce

dosomething.py:

print("doing something")

Dockerfile:

FROM python:3.11-alpine
ADD dosomething.py /dosomething.py
CMD ["python3", "/dosomething.py"]

job.yaml:

apiVersion: batch/v1
kind: Job
metadata:
  name: dosomething
spec:
  template:
    metadata:
      annotations:
        instrumentation.opentelemetry.io/inject-python: "true"
    spec:
      containers:
      - name: dosomething
        image: myregsitry/dosomething:latest
        imagePullPolicy: "Always"
      restartPolicy: Never
  backoffLimit: 4

Run the job with kubectl create -f job.yaml

What is the expected behavior?

Expected the job to run successfully

What is the actual behavior?

I get the following error in the logs for the "dosomething" container:

Defaulted container "dosomething" out of: dosomething, opentelemetry-auto-instrumentation (init)
Instrumenting of system_metrics failed
Traceback (most recent call last):
  File "/otel-auto-instrumentation/opentelemetry/instrumentation/auto_instrumentation/_load.py", line 87, in _load_instrumentors
    distro.load_instrumentor(entry_point, skip_dep_check=True)
  File "/otel-auto-instrumentation/opentelemetry/instrumentation/distro.py", line 62, in load_instrumentor
    instrumentor: BaseInstrumentor = entry_point.load()
                                     ^^^^^^^^^^^^^^^^^^
  File "/otel-auto-instrumentation/pkg_resources/__init__.py", line 2518, in load
    return self.resolve()
           ^^^^^^^^^^^^^^
  File "/otel-auto-instrumentation/pkg_resources/__init__.py", line 2524, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/otel-auto-instrumentation/opentelemetry/instrumentation/system_metrics/__init__.py", line 79, in <module>
    import psutil
  File "/otel-auto-instrumentation/psutil/__init__.py", line 102, in <module>
    from . import _pslinux as _psplatform
  File "/otel-auto-instrumentation/psutil/_pslinux.py", line 26, in <module>
    from . import _psutil_linux as cext
ImportError: Error relocating /otel-auto-instrumentation/psutil/_psutil_linux.abi3.so: __sched_cpufree: symbol not found
Failed to auto initialize opentelemetry
Traceback (most recent call last):
  File "/otel-auto-instrumentation/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py", line 39, in initialize
    _load_instrumentors(distro)
  File "/otel-auto-instrumentation/opentelemetry/instrumentation/auto_instrumentation/_load.py", line 91, in _load_instrumentors
    raise exc
  File "/otel-auto-instrumentation/opentelemetry/instrumentation/auto_instrumentation/_load.py", line 87, in _load_instrumentors
    distro.load_instrumentor(entry_point, skip_dep_check=True)
  File "/otel-auto-instrumentation/opentelemetry/instrumentation/distro.py", line 62, in load_instrumentor
    instrumentor: BaseInstrumentor = entry_point.load()
                                     ^^^^^^^^^^^^^^^^^^
  File "/otel-auto-instrumentation/pkg_resources/__init__.py", line 2518, in load
    return self.resolve()
           ^^^^^^^^^^^^^^
  File "/otel-auto-instrumentation/pkg_resources/__init__.py", line 2524, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/otel-auto-instrumentation/opentelemetry/instrumentation/system_metrics/__init__.py", line 79, in <module>
    import psutil
  File "/otel-auto-instrumentation/psutil/__init__.py", line 102, in <module>
    from . import _pslinux as _psplatform
  File "/otel-auto-instrumentation/psutil/_pslinux.py", line 26, in <module>
    from . import _psutil_linux as cext
ImportError: Error relocating /otel-auto-instrumentation/psutil/_psutil_linux.abi3.so: __sched_cpufree: symbol not found
doing something...

Additional context

Maybe this is caused by alpine?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions