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

Invoking sentry when in a path that does not exist causes a FileNotFoundError #2324

Closed
korhojoa opened this issue Aug 29, 2023 · 1 comment · Fixed by #2329
Closed

Invoking sentry when in a path that does not exist causes a FileNotFoundError #2324

korhojoa opened this issue Aug 29, 2023 · 1 comment · Fixed by #2329

Comments

@korhojoa
Copy link

How do you use Sentry?

Self-hosted/on-premise

Version

1.29.2

Steps to Reproduce

Go from sentry-sdk version 1.29.0 to 1.29.2 (this is where we noticed)

sentry-sdk==1.29.0
sentry-sdk==1.29.2

This is the line mentioned in the trace: bc209e5#diff-fb869cde7d11be4df35c1f0d0f45f5824cc0e76e6ada504a48e8ceefe363f739R250

Expected Result

It would work, like it did earlier, and not break the functionality of the tool being used.

I understand that this isn't a common situation, but I think it's unfair that a tool that's supposed to help troubleshoot is breaking functionality.

Actual Result

Running a command that uses sentry from a path that got cleaned up:

07:37:20      import sentry_sdk
07:37:20    File "/usr/local/lib/python3.11/site-packages/sentry_sdk/__init__.py", line 1, in <module>
07:37:20      from sentry_sdk.hub import Hub, init
07:37:20    File "/usr/local/lib/python3.11/site-packages/sentry_sdk/hub.py", line 10, in <module>
07:37:20      from sentry_sdk.client import Client
07:37:20    File "/usr/local/lib/python3.11/site-packages/sentry_sdk/client.py", line 34, in <module>
07:37:20      from sentry_sdk.profiler import has_profiling_enabled, setup_profiler
07:37:20    File "/usr/local/lib/python3.11/site-packages/sentry_sdk/profiler.py", line 251, in <module>
07:37:20      CWD = os.getcwd()
07:37:20            ^^^^^^^^^^^
07:37:20  FileNotFoundError: [Errno 2] No such file or directory
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Aug 29, 2023
@sentrivana
Copy link
Contributor

sentrivana commented Aug 29, 2023

Hey @korhojoa, thanks for reporting, we will fix this.

@Zylphrex could you please take a look? I'm assuming we need to handle potential FileNotFoundErrors, but I'm not sure what the behavior should be if one happens.

@getsantry getsantry bot removed the status in GitHub Issues with 👀 Aug 29, 2023
Zylphrex added a commit that referenced this issue Aug 29, 2023
When calling sentry from a cleaned up path, it should not cause an error. So
defer the `os.getcwd()` call until later.

Fixes #2324.
sentrivana pushed a commit that referenced this issue Aug 30, 2023
* fix(profiler): Do not call getcwd from module root

When calling sentry from a cleaned up path, it should not cause an error. So
defer the `os.getcwd()` call until later.

Fixes #2324.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants