Closed ramasangita closed 6 months ago
on_workerboot do || ::Instana.agent.after_fork end
here instead of after_fork, can we use spawn_background_thread?. I see that spawn_background_thread is asynchronous
@ramasangita The point of using a synchronous call for the announce, is to ensure that the tracer captures as many events from early during server startup as possible.
While it is unclear why you personally need an asynchronous announce call, (perhaps some readiness probes time out?)
the spawn_background_thread
is usable but that doesn't quarantee the recording of all the spans and metrics from the startup as the synchronous call does.
If I use after_fork, it is blocking the server startup completely. Puma server startup timeouts and application never starts. The current version which I am using is working fine.(1.11.6). after_fork is not blocking the startup in this version
So wondering for non cluster mode if we use spawn_background_thread https://github.com/instana/ruby-sensor/blob/master/lib/instana.rb#L18 can we not use same for cluster mode as well?
If I use after_fork, it is blocking the server startup completely.
Could you also provide some sample for this? Because I have tried this, and I have not seen any problem with the startup.
workers 3 [0/5100]
preload_app!
on_worker_boot do |_|
::Instana.agent.after_fork if defined?(::Instana)
end
If you observe blocking, that is indicative of a network issue, and ultimately an asynchronous annouce likelyl won't help you much. But as I said feel free to use asynchronous annouce ,if it is OK for you that some events might not be recorded.
Found the issue, HostAgentLookup is timing out(sometimes) which is triggering a loop on waiting connection. I think older version is doing it asynchronously so never realised it.
So closing this and will check from my end on timeouts
Problem Description
In Puma cluster mode when ::Instana.agent.after_fork is added, puma server startup is blocked. after_fork is blocking operation in the latest instana version
Minimal, Complete, Verifiable, Example
workers 1 preload_app!
on_workerboot do || ::Instana.agent.after_fork if defined?(::Instana) end
Add this in config/puma.rb and start the puma server
Gemfile.lock
Ruby Version