[#5219] Segmentation fault in timeout.rb — Michel Pastor <K@...>

Hi,

18 messages 2005/06/16
[#5220] Re: Segmentation fault in timeout.rb — Eric Hodel <drbrain@...7.net> 2005/06/16

[#5221] Re: Segmentation fault in timeout.rb — Michel Pastor <K@...> 2005/06/16

On Fri, 17 Jun 2005 05:03:18 +0900

[#5223] Re: Segmentation fault in timeout.rb — nobu.nokada@... 2005/06/17

Hi,

[#5296] Subversion — Shugo Maeda <shugo@...>

Hi,

64 messages 2005/06/30
[#5297] Re: Subversion — Curt Hibbs <curt@...> 2005/06/30

Shugo Maeda wrote:

[#5298] Re: Subversion — Nikolai Weibull <mailing-lists.ruby-core@...> 2005/06/30

Curt Hibbs wrote:

[#5301] Re: Subversion — Austin Ziegler <halostatue@...> 2005/06/30

On 6/30/05, Nikolai Weibull

[#5304] Re: Subversion — Nikolai Weibull <mailing-lists.ruby-core@...> 2005/06/30

Austin Ziegler wrote:

[#5305] Re: Subversion — Austin Ziegler <halostatue@...> 2005/06/30

On 6/30/05, Nikolai Weibull

[#5307] Re: Subversion — mathew <meta@...> 2005/06/30

Austin Ziegler wrote:

[#5308] Re: Subversion — Austin Ziegler <halostatue@...> 2005/06/30

On 6/30/05, mathew <meta@pobox.com> wrote:

[#5311] Re: Subversion — mathew <meta@...> 2005/07/01

Austin Ziegler wrote:

[#5323] Re: Subversion — Austin Ziegler <halostatue@...> 2005/07/01

On 7/1/05, mathew <meta@pobox.com> wrote:

[#5325] Re: Subversion — Nikolai Weibull <mailing-lists.ruby-core@...> 2005/07/01

Austin Ziegler wrote:

[ ruby-Bugs-2047 ] TCPSocket fails to bind first time on certain FreeBSD configs

From: noreply@...
Date: 2005-06-20 11:29:08 UTC
List: ruby-core #5256
Bugs item #2047, was opened at 2005-06-20 12:24
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=2047&group_id=426

Category: Standard Library
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Brian Candler (bcandler)
Assigned to: Nobody (None)
Summary: TCPSocket fails to bind first time on certain FreeBSD configs

Initial Comment:
I have some very strange reproducible behaviour with TCPSocket. It differs
between two machines which are almost identical: one is FreeBSD-5.4-RELEASE,
the other is FreeBSD-5.4-STABLE dating from only a week or so after
5.4-RELEASE. Both report Ruby version as
"ruby 1.8.2 (2004-12-25) [i386-freebsd5]"

The 5.4-RELEASE machine is running a GENERIC kernel with IPv6 enabled. The
5.4-STABLE machine has a slightly customised kernel, with IPv6 turned off.
This is the only thing which I can imagine is significant.

Now, it's the 5.4-STABLE machine (no IPv6) which is being strange:

$ irb
irb(main):001:0> require 'socket'
=> true
irb(main):002:0> a = TCPServer.new(1234)
=> #<TCPServer:0x813aed0>
irb(main):003:0> 

At this point, you'd expect the server to be listening on port 1234.
However, it isn't: in another window I can try

$ telnet localhost 1234
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host
$ sockstat -4l
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS      
mailnull exim-4.50- 432   4  tcp4   *:25                  *:*
root     sshd       393   4  tcp4   *:22                  *:*
root     lpd        363   7  tcp4   *:515                 *:*
root     syslogd    266   6  udp4   *:514                 *:*

However, as soon as I create a *second* TCPServer object, it works.

irb(main):003:0> b = TCPServer.new(1234)
=> #<TCPServer:0x81387c0>
irb(main):004:0> 

and in another window:

$ sockstat -4l
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS      
brian    ruby18     1186  4  tcp4   *:1234                *:*
mailnull exim-4.50- 432   4  tcp4   *:25                  *:*
root     sshd       393   4  tcp4   *:22                  *:*
root     lpd        363   7  tcp4   *:515                 *:*
root     syslogd    266   6  udp4   *:514                 *:*
$ telnet localhost 1234
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

This is completely repeatable. Now: if I give an IP address explicitly to
bind to, it's OK:

$ irb
irb(main):001:0> require 'socket'
=> true
irb(main):002:0> a = TCPServer.new("0.0.0.0",1234)
=> #<TCPServer:0x813a69c>
irb(main):003:0> 

$ sockstat -4l
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS      
brian    ruby18     1196  3  tcp4   *:1234                *:*
mailnull exim-4.50- 432   4  tcp4   *:25                  *:*
root     sshd       393   4  tcp4   *:22                  *:*
root     lpd        363   7  tcp4   *:515                 *:*
root     syslogd    266   6  udp4   *:514                 *:*

So I have a workaround which solves my problem - but it looks like there's something strange going on under the surface.

I have tried building the latest snapshot:
-rw-r--r--   1 snapshot nogroup   4124201 Jun 19 19:00 stable-snapshot.tar.gz

but the problem seems to be the same:

brian:/u/build/ruby$ ruby -I ext/socket -r socket -e 'a = TCPServer.new(1234); sleep 50' &
[1] 9335
brian:/u/build/ruby$ telnet localhost 1234
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host



----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=2047&group_id=426

In This Thread

Prev Next