-
Notifications
You must be signed in to change notification settings - Fork 732
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
Apparently never ending "Indexing call sites..." #1694
Comments
It's now been running for 20 hours. |
Hi @akimd - if Brakeman runs for more than ten minutes, there is probably something wrong. No, there is no out-of-the-box way to get visibility into what's happening during the call indexing phase. Is this a large codebase? Is Brakeman running in a memory-constrained environment? |
Justin, If you have a suggested diff to make it more verbose, I can do that. But now that I ran ps on it, I can see that its state is "(interruptible) Sleeping". It it run this way: bundle exec brakeman --no-exit-on-warn --no-exit-on-error --output test/brakeman.json --parser-timeout 30 --skip-files app/views/user_login_attempts/_query_builder_filters_list.html.erb,...,app/views/specialties/_query_builder_filters_list.html.erb,app/views/search_bookmarks/_query_builder_filters_list.html.erb --safe-methods strip_tags -d -n And
Any idea what it might be waiting for? |
Honestly still think it's a memory issue. I'll get back to you with a diff. If it's really stuck at call indexing, the debug flag isn't going to be helpful and in fact could be making the issue worse. |
I'd try adding logging to diff --git a/lib/brakeman/tracker.rb b/lib/brakeman/tracker.rb
index b6894f8b8..2b3c60c5d 100644
--- a/lib/brakeman/tracker.rb
+++ b/lib/brakeman/tracker.rb
@@ -253,21 +253,27 @@ class Brakeman::Tracker
finder = Brakeman::FindAllCalls.new self
self.each_method do |definition, set_name, method_name, file|
+ Brakeman.notify "[Call Index] #{file} #{set_name} #{method_name}"
finder.process_source definition, :class => set_name, :method => method_name, :file => file
end
self.each_class do |definition, set_name, file|
+ Brakeman.notify "[Call Index] #{file} #{set_name}"
finder.process_source definition, :class => set_name, :file => file
end
self.each_template do |_name, template|
+ Brakeman.notify "[Call Index] #{template.file}"
finder.process_source template.src, :template => template, :file => template.file
end
self.initializers.each do |file_name, src|
+ Brakeman.notify "[Call Index] #{file_name}"
finder.process_all_source src, :file => file_name
end
+ Brakeman.notify "Creating call index..."
+
@call_index = Brakeman::CallIndex.new finder.calls
end I'd also skip the I also recommend using a beefy machine with lots of free memory. Unfortunately Brakeman uses a lot of memory, especially for large applications. You can also try the |
Hi Justin,
The man page says "D uninterruptible sleep (usually IO)". The logs:
There's nothing specific about this last file.
As a matter of fact it grokked other versions of it for other types of resources. I'll send that file to you privately. I will also Wrt RAM, here's what I get on this machine (well, this image)
Cheers! |
Couldn't find a way to do that :) |
Hey, actually it still moves! It appeared to be stuck for a long while on
and now it is back in
|
It eventually ended. It started at 2022-04-01 14:11:46 and finished at 2022-04-01 17:53:05, in parallel. I'll see if I can add timestamps to my logs to see what steps were really long. |
That's the longest successful run I've ever heard of. Unless there is a really obvious root cause that you can easily reproduce with sample code, it's probably going to be hard to improve the situation without access to the source code of the Rails app. |
Justin, |
@akimd Not as-is, but adding logging for different stages is pretty easy. I can send you a diff, if you want. Typically, though, there is some pathological case that causes an explosion of nodes in Brakeman. Figuring out where that's happening can be challenging... especially if an app takes hours to process. Question... is it only the call indexing part that is slow? Or is it everything? This is giving me flashbacks to 2012 😄 |
Hi Justin,
Background
Brakeman version: 5.2.1
Rails version: 6.1.4.1
Ruby version: 2.7.2
Link to Rails application code: Sorry, I don't own the code, cannot do that. Besides I don't know what specific file would be responsible.
Hanging or Slowness
Please run Brakeman with
--debug
to see which file may be causing the issue.I did that, and actually I'd like to know if there's a way for Brakeman to be even more verbose and to describe what it's doing in this "Indexing" phase. I have not stopped it, maybe it is still making progress, I do not know, and don't know how I could know.
It displayed this "Indexing" message four hours ago.
Cheers!
The text was updated successfully, but these errors were encountered: