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-instrument command can cause recursive creation of subprocesses #1050

Closed
aabmass opened this issue Apr 12, 2022 · 0 comments · Fixed by #1066
Closed

opentelemetry-instrument command can cause recursive creation of subprocesses #1050

aabmass opened this issue Apr 12, 2022 · 0 comments · Fixed by #1066
Assignees
Labels
bug Something isn't working

Comments

@aabmass
Copy link
Member

aabmass commented Apr 12, 2022

Describe your environment

Python3.9, linux.

Steps to reproduce
Using opentelemetry-instrument with any exporter or instrumentation which invokes a python subprocess during initialization. For example, the opentelemetry-exporter-gcp-trace exporter may invoke the gcloud (written in python) command in a subprocess to get project information and authentication tokens. The subprocess will then try to autoinstrument, creating a recursive loop of subprocesses being created.

What is the expected behavior?
Auto-instrumentation should not apply to subprocesses created in the initialize() phase of auto-instrumentation. The PYTHONPATH environment variable should have the sitecustomize.py dirname stripped out at the beginning of sitecustomize.py. This would prevent subprocesses from being autoinstrumented during setup, which can cause a loop.

What is the actual behavior?
PYTHONPATH is correctly stripped later on to avoid this

finally:
environ["PYTHONPATH"] = sub(
rf"{dirname(abspath(__file__))}{pathsep}?",
"",
environ["PYTHONPATH"],
)

However, any subprocesses created in these lines will cause a loop.

Additional context
I can write a repro if necessary.

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
1 participant