使用 Pow 进行 ruby​​-debug -- 断点永远不会命中 [英] ruby-debug with Pow -- breakpoints never hit

查看:46
本文介绍了使用 Pow 进行 ruby​​-debug -- 断点永远不会命中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 ruby​​-debug 与 Pow 结合使用.Rails 3 应用.

I'm trying to use ruby-debug with Pow. Rails 3 app.

我在这里做了一切:https://gist.github.com/1098830

我已经多次重启服务器和机器.我可以让 rdebug 连接:

I've restarted the server and machine several times. I can get rdebug to connect:

→ rdebug -c
Connected.

但它永远不会停在断点处.

but it never stops at the breakpoints.

知道会发生什么吗?几个小时前我让它达到了几个断点,之后就没有了.

Any idea what could be going on? I got it to hit a few breakpoints a few hours ago, and not since.

控制器

  def index
    debugger
    ...
  end

宝石文件

gem 'ruby-debug19', :require => 'ruby-debug'

development.rb

development.rb

EG::Application.configure do
  ...
  require 'ruby-debug'
  Debugger.start_remote
  Debugger.settings[:autoeval] = true
  puts "=> Debugger enabled"
end

推荐答案

出现这种情况是因为 Pow 默认运行两个工作进程,而 rdebug 只连接到其中一个.如果另一个进程为请求服务,则没有骰子.解决办法是强制Pow运行单个worker进程,如下:

This happens because Pow runs two worker processes as default, and rdebug only connects to one of them. If the other process serves the request, then no dice. The solution is to force Pow to run a single worker process, as follows:

  1. 编辑 ~/.powconfig 以包含 export POW_WORKERS=1
  2. 通过杀死 Pow 进程重新启动 Pow 本身

您现在应该在每个请求上都打断点.

You should now hit your breakpoint on every request.

这篇关于使用 Pow 进行 ruby​​-debug -- 断点永远不会命中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆