-
Notifications
You must be signed in to change notification settings - Fork 734
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
Brakeman hangs scanning controllers. #36
Comments
Awesome. I'll dig into this. |
There seem to be a couple things going on here. First clue is that it's not in an infinite loop, it's just slowing down a ton. The slow down is due to deep copying of the values. The values themselves are growing quite large. One reason they are growing large is because of assignments inside branches, which are turned into OR'ed values. This has been greatly alleviated with my latest commit. Another reason they are growing large is because of I THINK what's happening is that this state is being stored, and every time However, in the meantime, I've fixed the |
Okay, scratch my "stored state" theory. The rest is right, though. What's weird is that this is happening when running Brakeman, but not if I run the |
It seems like the issue is that |
Issue still persists |
Hmm yeah there's a default routes warning, going to fix that and see |
I was able to work around this with the 1.2.2 code base (without your most recent changes) by using a local variable to do the manipulation inside the map block:
to
I remember having issues with modifying objects when inside a iterator block in Java, I think it would throw ConcurrentModificationException. I imagine whatever ruby does (probably making a billion copies) to get around Java's limitation is causing the hang. Even with the latest code base, it hangs until I run out of memory ~30 minutes in. Going to use the workaround for now. |
Well, how Ruby handles modification of a block parameter (which this code is not really doing) would have nothing to do with Brakeman, as it's not executing the code. However, this does narrow down the issue. The problem comes from how Brakeman is processing the assignments. Original: somevar = (local somevar).split(",").map do |s|
s = ((local s) + "stuff") unless (local s) =~ /regex/
((local s) + "stuffstuffstuffstuffstuffstuffstuffstuff").split("things")
end.first Using tmp: somevar = (local somevar).split(",").map do |s|
tmp = (local s)
tmp = ((local s) + "stuff") unless (local s) =~ /regex/
((local s) or ((local s) + "stuff")).split("things")
end.first Edit: I should be able to get this fixed tomorrow. |
to attempt to avoid stuff blowing up ridiculously which should help #36
Okay, I think I've resolved it. Please try the latest. |
success! |
Cool...unfortunately, I don't like it. It prevents detection of some simple things. I have a couple other ideas, though. On Feb 7, 2012, at 5:03 PM, Neil Matatall reply@reply.github.com wrote:
|
Hey Neil, can you verify that the latest still works for you? Thanks! |
Still works, seems faster |
Okay, cool. Thanks. |
Placing the following code in test/apps/rails2/app/controllers/application_controller.rb seems to cause brakeman to hang indefinitely when I attempt to run tests. This came up in an app we were testing.
The text was updated successfully, but these errors were encountered: