How to debug and profile rails library code ( in windows )

Hi, I have a project on windows using rails 2.3.5, ruby 1.8.6, mysql 5.0.28, and mysql gem 2.8.1.

I am trying to debug a problem where it seems like each rails thread hangs before it has the chance to release the db connection to the pool. When the number of active connections reaches the total number available in the pool, the next request times out for five seconds before getting processed.

I have tried many things to identify what is causing this problem and now I think I need to run profiling and/or debugging inside the rails code to find out where it is hanging. (For example - I've gotten rid of database session stores to see if that was the cause, as older posts have indicated.)

How do I configure my project which currently has gems installed for rails to use source code so I can edit and debug it?

Thanks,

Ryan

How do I configure my project which currently has gems installed for rails to use source code so I can edit and debug it?

I assume you're debugging anyways:

If you do that you can step out into the rails code to see what's happening. If you want to actually put debug lines into rails source code then how about freezing the rails gems into your project? Then you could edit them and step out at any point you like.

Cheers Luke

Thanks Luke - freezing the gems is what I need because I am embedding ruby profile calls in there.

However, now I'm trying to add the profiling inside mongrel, because the profiling I added in ActionController::Base.process did not show me where the delay is occurring.

I did an unpack of mongrel and copied it to vendor along with adding the profiling code, but I'm unable to get the vendor version of mongrel_rails to execute when I run the script\server.

How do I get the mongrel_rails executable in vendor override the one in path?

thanks!

Keeping it simple - you could just rename the one in your ruby bin directory or uninstall the mongrel gem! :slight_smile: