-
Notifications
You must be signed in to change notification settings - Fork 599
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
Unable to use Infinite Tracing with a forking webserver (puma) #1706
Comments
Hi @chrisholmes! Thank you for bringing attention to this and sharing the GRPC issue! We will take a look at workarounds and follow up with updates. |
Hi @hannahramadan, thanks for quick reply. After raising this, I realised I could do a workaround by not requiring the infinite tracing source until after work book. The workaround looks like:
|
@chrisholmes thanks for sharing your solution and it's great to see you've found a workaround. We are still interested in addressing this, so I'll leave the issue open while we continue to take a look :) |
Hi @chrisholmes! Thanks again for reporting this and sharing your workaround. I'm changing the "bug" label just for some internal bookkeeping that differentiates between agent code bugs and agent compatibility issues, but we're going to keep this issue open for others to find your workaround and for us to continue to brainstorm compatibility solutions with forking. Cheers! |
Oh, I've been experimenting with On a side note, from the description of
This seems outdated. |
Hello @chrisholmes I've spent some time looking into this issue but I haven't been able to reproduce it. Originally I was seeing issues with infinite tracing when forking and thought I had reproduced the issue, but after looking into it more to try to solve the issue, it turns out that I was encountering a different issue that seems to only affect grpc forking on macs. I wasn't able to get it working using the workaround you provided and then saw that it was not the same
whenever grpc would try to connect. This happened even if the agent was not started or loaded until after forking. However, this didn't happen if it never forked, or if grpc was turned off. Since this seemed to be specific to macs, I used docker after this. Once I switched to using the ruby docker image, that error was no longer present and I was able to focus on infinite tracing and puma, but I was not able to reproduce the original infinite tracing issue you reported. I tried changing a couple settings in puma, including number of workers, and using/not using The agent has built in logic to defer startup until after forking when a forking dispatcher is detected. Since infinite tracing doesn't startup until after the agent has connected, this also forces grpc to wait until after forking as well. One thing you could check what dispatcher the agent is detecting by looking at agent logs. You should be able to find a line that includes For me though, even when no known dispatcher was detected I was still unable to reproduce the issue, but my test app is a very simple rails 7 app. It's possible my simple rails 7 test app is missing something that is affecting the issue. What agent version are you using when you see the error? Any other details that you think might be helpful in reproducing the issue would also be appreciated. |
Closing this, since we have been unable to reproduce this behavior and have not heard back. Please reopen this if setting the dispatcher doesn't make any change or if there is some additional info you can provide to help with a reproduction. |
Description
We have a Rails application that is deployed with a forking webserver (puma) that we have recently tried to migrate onto Infinite tracing. While it works locally when puma is set to a single work mode we have found that it doesn't work when the tracer is set to clustered(forking) mode where the rails app is preloaded (for performance reasons) before forking .
We've found that after a fork, while other parts of the agent are able to restart successfully, the infinite tracer is not restarted successfully.
If we try to manually restart the infinite tracer's connection then a GRPC error is raised:
RuntimeError: grpc cannot be used before and after forking
. This issue discusses the issue and suggests that no fix is forthcoming soon: grpc/grpc#8798.Do you have any recommendations for fixes/optimal configuration for puma? Is it possible to defer the infinite tracer to boot after a fork?
Expected Behavior
Tracing continues to work after a fork
Steps to Reproduce
Your Environment
Our application is a Rail 7 application running on Ruby 3.1 and we are currently running puma 5.6.
We have the following puma settings:
The text was updated successfully, but these errors were encountered: