Connection refused error after updating to 1.6.X in a Rails project running inside docker

未关闭
#761 15 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
docker, rails, ruby
领域
devtools

调研方向

Reproduce the failure with the Ruby 3.1.2-slim Docker image and the listed rdbg command, then inspect debug-1.6.0/lib/debug/client.rb at connect_unix and compare its socket naming with debug 1.5.0. Done means rdbg -A attaches to the running Rails/Puma process after updating to a 1.6 release.

由索引模型根据 Issue 内容生成。

描述

Your environment

  • ruby -v: ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [aarch64-linux]
  • rdbg -v: working: rdbg 1.5.0, non-working rdbg 1.6.X

Describe the bug
I'm using the official Ruby 3.1.2-slim docker image. After updating the debug gem from 1.5.0 to 1.6.X, I cannot attach to the running process any more.

I'm running a Rails project with the latest Rails version (7.0.4) and the Puma web server. This is the command I'm running:

rdbg --open --nonstop -c -- rails s -b '0.0.0.0'

Using debug 1.5.0, all is well:

❯ dc exec web rdbg -A
# No sourcefile available for /usr/local/bundle/gems/puma-5.6.5/lib/puma/single.rb
=>#0    [C] Thread#join at /usr/local/bundle/gems/puma-5.6.5/lib/puma/single.rb:61
  #1    Puma::Single#run at /usr/local/bundle/gems/puma-5.6.5/lib/puma/single.rb:61
  # and 15 frames (use `bt' command for all frames)

Stop by SIGURG
(rdbg:remote) c    # continue command

Socket name (automatically chosen by the debug gem): /tmp/ruby-debug-sock-0/ruby-debug-ruby-debug-1

Using debug 1.6.X, the connection does not work any more:

/usr/local/lib/ruby/3.1.0/socket.rb:64:in `connect': Connection refused - connect(2) for /tmp/ruby-debug-sock-0/ruby-debug-UnknownUser-1 (Errno::ECONNREFUSED)
        from /usr/local/lib/ruby/3.1.0/socket.rb:64:in `connect_internal'
        from /usr/local/lib/ruby/3.1.0/socket.rb:137:in `connect'
        from /usr/local/lib/ruby/3.1.0/socket.rb:1078:in `unix'
        from /usr/local/bundle/gems/debug-1.6.0/lib/debug/client.rb:158:in `connect_unix'
        from /usr/local/bundle/gems/debug-1.6.0/lib/debug/client.rb:108:in `initialize'
        from /usr/local/bundle/gems/debug-1.6.0/exe/rdbg:31:in `new'
        from /usr/local/bundle/gems/debug-1.6.0/exe/rdbg:31:in `<top (required)>'
        from /app/bin/rdbg:29:in `load'
        from /app/bin/rdbg:29:in `<main>'

Socket name (automatically chosen by the debug gem): /tmp/ruby-debug-sock-0/ruby-debug-UnknownUser-1

Notice the change in the socket name, maybe this has something to do with this issue? The socket does exist, though, and permissions seem correct.

To Reproduce
Update debug to 1.6.X. I've tried all released 1.6 versions, none of them is working. Going back to 1.5 resolves the issue for me.

Expected behavior
rdbg -A connects to the running process.

主要语言
Ruby
星标
1.3k
派生
146
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ruby/debug 的其他 Issue

查看 ruby/debug 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。