Bug #9373
closedtest_autobind(TestSocket_UNIXSocket) fails on PPC
Description
=begin
test_autobind(TestSocket_UNIXSocket) fails quite often on PPC:
test_autobind(TestSocket_UNIXSocket):
Errno::ECONNREFUSED: Connection refused - connect(2)
/builddir/build/BUILD/ruby-2.0.0-p247/.ext/common/socket.rb:65:in connect' /builddir/build/BUILD/ruby-2.0.0-p247/.ext/common/socket.rb:65:in connect_internal'
/builddir/build/BUILD/ruby-2.0.0-p247/.ext/common/socket.rb:135:in connect' /builddir/build/BUILD/ruby-2.0.0-p247/.ext/common/socket.rb:765:in unix'
/builddir/build/BUILD/ruby-2.0.0-p247/test/socket/test_unix.rb:589:in block in test_autobind' /builddir/build/BUILD/ruby-2.0.0-p247/.ext/common/socket.rb:806:in unix_server_socket'
/builddir/build/BUILD/ruby-2.0.0-p247/test/socket/test_unix.rb:585:in `test_autobind'
=end
        
           Updated by vo.x (Vit Ondruch) over 11 years ago
          Updated by vo.x (Vit Ondruch) over 11 years ago
          
          
        
        
      
      So this issue was recently reported also into RH bugzilla [1] and Gustavo provided reproducer [2] for this issue:
#include <sys/socket.h>
#include <stdio.h>
int main()
{
        int fd = socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC, 0);
        int i = 1;
        setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &i, 4);
        struct sockaddr addr;
        addr.sa_family = AF_LOCAL;
        bind(fd, &addr, 2);
        listen(fd, 128);
        struct sockaddr_storage ss;
        socklen_t sslen = (socklen_t)sizeof(ss);
        getsockname(fd, (struct sockaddr*)&ss, &sslen);
        fd = socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC, 0);
        if (connect(fd, (struct sockaddr*)&ss, sslen) == -1){
                perror(NULL);
                return 1;
        }
        printf("OK\n");
        return 0;
} 
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1070206
[2] https://bugzilla.redhat.com/show_bug.cgi?id=1070206#c2
        
           Updated by vo.x (Vit Ondruch) over 11 years ago
          Updated by vo.x (Vit Ondruch) over 11 years ago
          
          
        
        
      
      - Status changed from Open to Third Party's Issue
Closing, since this will be fixed in Kernel. Sorry for the noise.