Skip to content

fix(profiling): Start profiler thread lazily - #1903

Merged
Zylphrex merged 30 commits into
masterfrom
txiao/fix/start-profiler-thread-lazily
Feb 22, 2023
Merged

Zylphrex merged 30 commits into
masterfrom
txiao/fix/start-profiler-thread-lazily

Conversation

@Zylphrex

Copy link
Copy Markdown
Member

When running with uWSGI, it preforks the process so the profiler thread is started on the master process but doesn't run on the worker process. This means that no samples are ever taken. This change delays the start of the profiler thread to the first profile that is started.

@Zylphrex
Zylphrex changed the base branch from master to txiao/tests/add-workflow-to-test-gevent February 17, 2023 17:51
When running with uWSGI, it preforks the process so the profiler thread is
started on the master process but doesn't run on the worker process. This means
that no samples are ever taken. This change delays the start of the profiler
thread to the first profile that is started.
@Zylphrex
Zylphrex force-pushed the txiao/fix/start-profiler-thread-lazily branch from 1acca19 to 9fb3ace Compare February 17, 2023 17:52
Base automatically changed from txiao/tests/add-workflow-to-test-gevent to master February 21, 2023 14:46
Comment thread sentry_sdk/profiler.py Outdated
self.pid = pid
self.running = True

self.thread = self.make_thread()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can ThreadPool(1) not be called here directly?

@Zylphrex
Zylphrex merged commit 2d24560 into master Feb 22, 2023
@Zylphrex
Zylphrex deleted the txiao/fix/start-profiler-thread-lazily branch February 22, 2023 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants