-
-
Notifications
You must be signed in to change notification settings - Fork 501
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
RuntimeError: profile not started from a Sidekiq worker when profiling is enabled (Vernier) #2457
Comments
Thanks for the report. I'll look into this! |
I'm having trouble reproducing this exactly, but I did manage to see Vernier breaking when there's more than one worker running. I still need to investigate what exactly causes this. Will report back when I learn more! |
Hey @jhawthorn and @mperham - any chance you could help me out here? What I discovered is that when there’s more than one worker running, profiling via Vernier is choking on either “Profile already started” or “profile not started” errors. On Sentry side, we simply start a transaction which eventually calls Vernier::Profiler#start, then once transaction ends we stop it which eventually calls Venier::Profile#stop. These two start/stop methods is where we get our crashes about profile either not started yet or already stopped. It seems like when multiple workers are running Vernier is silently failing maybe? Or maybe we’re not handling Vernier start/stop correctly? I’d appreciate any guidance here 🙏🏻 |
Are you trying to profile two jobs concurrently in the same process? That sounds like a bad time, which is why the Sidekiq wiki page notes that you really should only profile manually, to keep contention down. You could also target different processes via queue selection. Retries may automatically deal with this. |
I missed the context here. Sidekiq will support Vernier natively in 8.0; it's already on the https://github.com/sidekiq/sidekiq/wiki/Profiling PS "getsantry" above ^^^^^ looks very suspicious. |
@mperham thank you! @vittorius we should wait until sidekiq 8.0 is released and try it out, until then there's not much we can do on Sentry side. |
My understanding is that Vernier is only designed to run globally. You can’t run it on multiple threads concurrently so I don’t think Sentry’s attempt to automatically profile every job will work. Sidekiq’s documentation explicitly says to only use this feature manually for this reason. Am I misunderstanding Vernier or your usage? |
@solnic it is fine to profile only one thread at a time and document that limitation. |
@solnic thank you for the effort. This doesn't block me actually since it was only an experiment on my project. Good to know anyway. |
@sl0thentr0py OK so just catch these errors and log them, yeah? |
Issue Description
I have a project that uses
sentry-ruby
,sentry-rails
, andsentry-sidekiq
, all of version 5.21.0. When I enable Profiling according to the docs and deploy the application, I start getting theRuntimeError: profile not started
from all of my Sidekiq workersReproduction Steps
Expected Behavior
No errors, profile samples from workers are visible in Sentry UI
Actual Behavior
RuntimeError: profile not started
Ruby Version
3.3.4
SDK Version
5.21.0
Integration and Its Version
Rails 7.1.4.1, Sidekiq 7.1.6, Vernier 1.3.1
Sentry Config
The text was updated successfully, but these errors were encountered: