Rails session hangs on hitting debugger line of code

Hi - Am using ruby-debug gem. When i run my rails application, once the
control reaches the ‘debugger’ line, the entire session hangs. I cannot
type or execute any commands further. Can i get some help here?

My code:

require 'ruby-debug'

module Rearview
  class MonitorController < Rearview::ApplicationController

    before_action only: [:create] do
      clean_empty_array_vals(:metrics)
    end

    #
    # TODO this should be moved to the JobsController#test and the UI
changed to push the
    # monitor job model instead of custom params
    #
    def create
      @errors = if params[:metrics].empty?
      Rails.logger.debug("ANANTH1:: errors obj:: #{@errors.inspect}")
                  [ "No metrics were provided" ]
                else
                  metrics_validator =
Rearview::MetricsValidator.new({attributes: [:metrics]})
                  params[:metrics].inject([]) { |a,v| a << "Metrics
contains an invalid metric: #{v}"
unless(metrics_validator.metric_valid?(v)); a }
                end
*debugger*
      results = if @errors.empty?
      Rails.logger.debug("ANANTH2:: results obj:: #{@results.inspect}")
      Rails.logger.debug("ANANTH3:: #{:metrics}")

Rearview::MonitorRunner.run(params[:metrics],params[:monitorExpr],params[:minutes],{},false,params[:toDate],true)
                else
                  { }
                end
      @monitor_output = 
Rearview::MonitorRunner.normalize_results(results)
      Rails.logger.debug("ANANTH4:: monitor_output obj::
#{@monitor_output.inspect}")
    end

  end
end

Session hangs here…
---------------------------------------
/usr/local/rvm/gems/jruby-1.7.12/gems/ruby-debug-base-0.10.4-java/lib/ruby-debug-base.rb:214
warning: tracing (e.g. set_trace_func) will not capture all events
without
–debug flag
/usr/local/rvm/gems/jruby-1.7.12/gems/rearview-1.2.1-java/app/controllers/rearview/monitor_controller.rb:23
results = if @errors.empty?
(rdb:1)
---------------------------------------

I had problems with debugger too, try using pry.

On 7 May 2014 15:49, Ananth K. [email protected] wrote:

Hi - Am using ruby-debug gem. When i run my rails application, once the
control reaches the ‘debugger’ line, the entire session hangs. I cannot type
or execute any commands further. Can i get some help here?

If you are using ruby 1.9 or above then I believe ruby-debug is not
compatible. I think pry, as already suggested, may be the best way to
go.

Colin