From: Peter Schuller Date: 2004-02-05T09:28:04+09:00 Subject: WEBrick always binds twice -> fails Hello, I have a problem with WEBrick on my Gentoo system. Whenever one tries to launch WEBrick - even with a basic example such as those on the front of the WEBrick page - it attempts to bind *twice* and thus fails. For example (when trying to run a Borges example): [2004-02-05 01:27:38] INFO WEBrick 1.3.1 [2004-02-05 01:27:38] INFO ruby 1.8.0 (2003-08-04) [i686-linux-gnu] [2004-02-05 01:27:38] WARN TCPServer Error: Address already in use - bind(2) /usr/lib/ruby/1.8/webrick/server.rb:91:in `listen': Address already in use - bind(2) (Errno::EADDRINUSE) from /usr/lib/ruby/site_ruby/1.8/Borges/WEBrick.rb:67:in `create' from /usr/lib/ruby/site_ruby/1.8/Borges/WEBrick.rb:77:in `start' from /usr/lib/ruby/site_ruby/1.8/Borges/WEBrick.rb:88 Note that this happens regardless of which port is used. Here is the relevant part of a strace - note how it first binds successfully and then tries again and fails. Does the failing _llseek() have anything to do with it perhaps? bind(3, {sa_family=AF_INET, sin_port=htons(7000), sin_addr=inet_addr("0.0.0.0")}, 16) = 0 listen(3, 5) = 0 fcntl64(3, F_GETFL) = 0x2 (flags O_RDWR) fstat64(3, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40569000 _llseek(3, 0, 0xbfff93b4, SEEK_CUR) = -1 ESPIPE (Illegal seek) fcntl64(3, F_GETFL) = 0x2 (flags O_RDWR) fstat64(3, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4056a000 _llseek(3, 0, 0xbfff93b4, SEEK_CUR) = -1 ESPIPE (Illegal seek) fcntl64(3, F_GETFD) = 0 gettimeofday({1075940535, 686187}, NULL) = 0 socket(PF_INET6, SOCK_STREAM, 6) = 4 setsockopt(4, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 bind(4, {sa_family=AF_INET6, sin6_port=htons(7000), inet_pton(AF_INET6, "::", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = -1 EADDRINUSE (Address already in use) I have not been able to reproduce this on another system (running FreeBSD). Has anyone seen this? It occurrs with both Ruby 1.8.0 and 1.8.1. -- / Peter Schuller, InfiDyne Technologies HB PGP userID: 0xE9758B7D or 'Peter Schuller ' Key retrieval: Send an E-Mail to getpgpkey@scode.org E-Mail: peter.schuller@infidyne.com Web: http://www.scode.org