[ruby-core:121500] [Ruby Bug#21211] Incomplete Backtrace for Socket Errors in Ruby 3.4+

Issue #21211 has been reported by ioquatix (Samuel Williams). ---------------------------------------- Bug #21211: Incomplete Backtrace for Socket Errors in Ruby 3.4+ https://bugs.ruby-lang.org/issues/21211 * Author: ioquatix (Samuel Williams) * Status: Open * Assignee: shioimm (Misaki Shioi) * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- When invoking `Socket.tcp` with an invalid hostname (e.g., "foo.bar") in Ruby 3.4, the error raised does not provide a complete backtrace indicating the original application code that made the call. This behavior differs from Ruby 3.3 where the backtrace includes the relevant context. ## Steps to Reproduce: Run the following code in an IRB session with Ruby 3.4.2: ```ruby require 'socket' Socket.tcp("foo.bar", 80) ``` Observe the error output: ``` /opt/rubies/3.4.2/lib/ruby/3.4.0/socket.rb:955:in 'Addrinfo.getaddrinfo': getaddrinfo: nodename nor servname provided, or not known (Socket::ResolutionError) from /opt/rubies/3.4.2/lib/ruby/3.4.0/socket.rb:955:in 'Socket.resolve_hostname' from /opt/rubies/3.4.2/lib/ruby/3.4.0/socket.rb:711:in 'block (2 levels) in Socket.tcp_with_fast_fallback' ``` ## Expected Behavior: The error backtrace should include the original application code that triggered the socket call, providing better context for debugging. ``` /Users/samuel/.rubies/ruby-3.1.6/lib/ruby/3.1.0/socket.rb:227:in `getaddrinfo': getaddrinfo: nodename nor servname provided, or not known (SocketError) from /Users/samuel/.rubies/ruby-3.1.6/lib/ruby/3.1.0/socket.rb:227:in `foreach' from /Users/samuel/.rubies/ruby-3.1.6/lib/ruby/3.1.0/socket.rb:632:in `tcp' from (irb):2:in `<main>' from /Users/samuel/.rubies/ruby-3.1.6/lib/ruby/gems/3.1.0/gems/irb-1.4.1/exe/irb:11:in `<top (required)>' from /Users/samuel/.rubies/ruby-3.1.6/bin/irb:25:in `load' from /Users/samuel/.rubies/ruby-3.1.6/bin/irb:25:in `<main>' ``` The change in how error backtraces are reported in Ruby 3.4 diminishes the ability to trace errors to user-level code, impacting debugging efforts. Can we restore or improve the backtrace reporting for socket-related errors. -- https://bugs.ruby-lang.org/

Issue #21211 has been updated by byroot (Jean Boussier). Backport changed from 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN to 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: REQUIRED https://github.com/ruby/ruby/pull/13041 ---------------------------------------- Bug #21211: Incomplete Backtrace for Socket Errors in Ruby 3.4+ https://bugs.ruby-lang.org/issues/21211#change-112538 * Author: ioquatix (Samuel Williams) * Status: Open * Assignee: shioimm (Misaki Shioi) * Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: REQUIRED ---------------------------------------- When invoking `Socket.tcp` with an invalid hostname (e.g., "foo.bar") in Ruby 3.4, the error raised does not provide a complete backtrace indicating the original application code that made the call. This behavior differs from Ruby 3.3 where the backtrace includes the relevant context. ## Steps to Reproduce: Run the following code in an IRB session with Ruby 3.4.2: ```ruby require 'socket' Socket.tcp("foo.bar", 80) ``` Observe the error output: ``` /opt/rubies/3.4.2/lib/ruby/3.4.0/socket.rb:955:in 'Addrinfo.getaddrinfo': getaddrinfo: nodename nor servname provided, or not known (Socket::ResolutionError) from /opt/rubies/3.4.2/lib/ruby/3.4.0/socket.rb:955:in 'Socket.resolve_hostname' from /opt/rubies/3.4.2/lib/ruby/3.4.0/socket.rb:711:in 'block (2 levels) in Socket.tcp_with_fast_fallback' ``` ## Expected Behavior: The error backtrace should include the original application code that triggered the socket call, providing better context for debugging. ``` /Users/samuel/.rubies/ruby-3.1.6/lib/ruby/3.1.0/socket.rb:227:in `getaddrinfo': getaddrinfo: nodename nor servname provided, or not known (SocketError) from /Users/samuel/.rubies/ruby-3.1.6/lib/ruby/3.1.0/socket.rb:227:in `foreach' from /Users/samuel/.rubies/ruby-3.1.6/lib/ruby/3.1.0/socket.rb:632:in `tcp' from (irb):2:in `<main>' from /Users/samuel/.rubies/ruby-3.1.6/lib/ruby/gems/3.1.0/gems/irb-1.4.1/exe/irb:11:in `<top (required)>' from /Users/samuel/.rubies/ruby-3.1.6/bin/irb:25:in `load' from /Users/samuel/.rubies/ruby-3.1.6/bin/irb:25:in `<main>' ``` The change in how error backtraces are reported in Ruby 3.4 diminishes the ability to trace errors to user-level code, impacting debugging efforts. Can we restore or improve the backtrace reporting for socket-related errors. -- https://bugs.ruby-lang.org/

Issue #21211 has been updated by ioquatix (Samuel Williams). Thanks @byroot, this must be some kind of record from bug report to merged fix. ---------------------------------------- Bug #21211: Incomplete Backtrace for Socket Errors in Ruby 3.4+ https://bugs.ruby-lang.org/issues/21211#change-112565 * Author: ioquatix (Samuel Williams) * Status: Closed * Assignee: shioimm (Misaki Shioi) * Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: REQUIRED ---------------------------------------- When invoking `Socket.tcp` with an invalid hostname (e.g., "foo.bar") in Ruby 3.4, the error raised does not provide a complete backtrace indicating the original application code that made the call. This behavior differs from Ruby 3.3 where the backtrace includes the relevant context. ## Steps to Reproduce: Run the following code in an IRB session with Ruby 3.4.2: ```ruby require 'socket' Socket.tcp("foo.bar", 80) ``` Observe the error output: ``` /opt/rubies/3.4.2/lib/ruby/3.4.0/socket.rb:955:in 'Addrinfo.getaddrinfo': getaddrinfo: nodename nor servname provided, or not known (Socket::ResolutionError) from /opt/rubies/3.4.2/lib/ruby/3.4.0/socket.rb:955:in 'Socket.resolve_hostname' from /opt/rubies/3.4.2/lib/ruby/3.4.0/socket.rb:711:in 'block (2 levels) in Socket.tcp_with_fast_fallback' ``` ## Expected Behavior: The error backtrace should include the original application code that triggered the socket call, providing better context for debugging. ``` /Users/samuel/.rubies/ruby-3.1.6/lib/ruby/3.1.0/socket.rb:227:in `getaddrinfo': getaddrinfo: nodename nor servname provided, or not known (SocketError) from /Users/samuel/.rubies/ruby-3.1.6/lib/ruby/3.1.0/socket.rb:227:in `foreach' from /Users/samuel/.rubies/ruby-3.1.6/lib/ruby/3.1.0/socket.rb:632:in `tcp' from (irb):2:in `<main>' from /Users/samuel/.rubies/ruby-3.1.6/lib/ruby/gems/3.1.0/gems/irb-1.4.1/exe/irb:11:in `<top (required)>' from /Users/samuel/.rubies/ruby-3.1.6/bin/irb:25:in `load' from /Users/samuel/.rubies/ruby-3.1.6/bin/irb:25:in `<main>' ``` The change in how error backtraces are reported in Ruby 3.4 diminishes the ability to trace errors to user-level code, impacting debugging efforts. Can we restore or improve the backtrace reporting for socket-related errors. -- https://bugs.ruby-lang.org/

Issue #21211 has been updated by k0kubun (Takashi Kokubun). Backport changed from 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: REQUIRED to 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONE ruby_3_4 commit:e3fc29a9b7. ---------------------------------------- Bug #21211: Incomplete Backtrace for Socket Errors in Ruby 3.4+ https://bugs.ruby-lang.org/issues/21211#change-112703 * Author: ioquatix (Samuel Williams) * Status: Closed * Assignee: shioimm (Misaki Shioi) * Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONE ---------------------------------------- When invoking `Socket.tcp` with an invalid hostname (e.g., "foo.bar") in Ruby 3.4, the error raised does not provide a complete backtrace indicating the original application code that made the call. This behavior differs from Ruby 3.3 where the backtrace includes the relevant context. ## Steps to Reproduce: Run the following code in an IRB session with Ruby 3.4.2: ```ruby require 'socket' Socket.tcp("foo.bar", 80) ``` Observe the error output: ``` /opt/rubies/3.4.2/lib/ruby/3.4.0/socket.rb:955:in 'Addrinfo.getaddrinfo': getaddrinfo: nodename nor servname provided, or not known (Socket::ResolutionError) from /opt/rubies/3.4.2/lib/ruby/3.4.0/socket.rb:955:in 'Socket.resolve_hostname' from /opt/rubies/3.4.2/lib/ruby/3.4.0/socket.rb:711:in 'block (2 levels) in Socket.tcp_with_fast_fallback' ``` ## Expected Behavior: The error backtrace should include the original application code that triggered the socket call, providing better context for debugging. ``` /Users/samuel/.rubies/ruby-3.1.6/lib/ruby/3.1.0/socket.rb:227:in `getaddrinfo': getaddrinfo: nodename nor servname provided, or not known (SocketError) from /Users/samuel/.rubies/ruby-3.1.6/lib/ruby/3.1.0/socket.rb:227:in `foreach' from /Users/samuel/.rubies/ruby-3.1.6/lib/ruby/3.1.0/socket.rb:632:in `tcp' from (irb):2:in `<main>' from /Users/samuel/.rubies/ruby-3.1.6/lib/ruby/gems/3.1.0/gems/irb-1.4.1/exe/irb:11:in `<top (required)>' from /Users/samuel/.rubies/ruby-3.1.6/bin/irb:25:in `load' from /Users/samuel/.rubies/ruby-3.1.6/bin/irb:25:in `<main>' ``` The change in how error backtraces are reported in Ruby 3.4 diminishes the ability to trace errors to user-level code, impacting debugging efforts. Can we restore or improve the backtrace reporting for socket-related errors. -- https://bugs.ruby-lang.org/
participants (3)
-
byroot (Jean Boussier)
-
ioquatix (Samuel Williams)
-
k0kubun (Takashi Kokubun)