Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#25143 - [filesystem] IPv6 configuration for localhost in /etc/hosts is broken

Attached to Project: Arch Linux
Opened by Csaba Henk (csheemea) - Saturday, 16 July 2011, 14:40 GMT
Last edited by Tom Gundersen (tomegun) - Monday, 25 July 2011, 14:44 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Pierre Schmitz (Pierre)
Thomas Bächler (brain0)
Tom Gundersen (tomegun)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

What we have in /etc/hosts related to IPv6 is

::1 localhost.localdomain localhost

and that's not sufficient, it makes some IPv6 capable tools not being able to use localhost (most notably ab [http://httpd.apache.org/docs/2.2/programs/ab.html] but also seen with the IPv6 enabled git version of glusterfs [https://github.com/gluster/glusterfs]).

The proper configuration for localhost would be the one described here:

http://www.bieringer.de/linux/IPv6/IPv6-HOWTO/IPv6-HOWTO-6.html

Additional info:

* package version(s): filesystem 2011.04-1, referred /etc/hosts file is http://projects.archlinux.org/svntogit/packages.git/tree/filesystem/trunk/hosts?id=b8efbc3c43bf9c8f60edb684e680567427ea0b30

Steps to reproduce:

* Start a http server on localhost, eg.:

ruby -rwebrick -e 's=WEBrick::HTTPServer.new(:Port => 8001 ); s.mount_proc("/") { |rq, rs| rs.body="hello world" }; %w[TERM INT].each { |sig| trap(sig) { s.shutdown }; s.start }'

* Try to reach the local httpd with ab:

ab http://localhost:8001/

* Actual result:

Benchmarking localhost (be patient)...apr_socket_recv: Connection refused (111)

* Expected result:

Benchmarking localhost (be patient).....done


Server Software: WEBrick/1.3.1
Server Hostname: localhost
Server Port: 8001

Document Path: /
Document Length: 11 bytes

Concurrency Level: 1
Time taken for tests: 0.006 seconds
Complete requests: 1
Failed requests: 0
Write errors: 0
Total transferred: 154 bytes
HTML transferred: 11 bytes
Requests per second: 180.05 [#/sec] (mean)
Time per request: 5.554 [ms] (mean)
Time per request: 5.554 [ms] (mean, across all concurrent requests)
Transfer rate: 27.08 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 5 5 0.0 5 5
Waiting: 5 5 0.0 5 5
Total: 6 6 0.0 6 6

* Fix: using the configuration suggested in the IPv6 Howto (cited above) fixes the problem.
This task depends upon

Closed by  Tom Gundersen (tomegun)
Monday, 25 July 2011, 14:44 GMT
Reason for closing:  Not a bug
Additional comments about closing:  Appears to work.
Comment by Csaba Henk (csheemea) - Saturday, 16 July 2011, 14:52 GMT
ruby command for sample web server has a typo, correct one is:

ruby -rwebrick -e 's=WEBrick::HTTPServer.new(:Port => 8001); s.mount_proc("/") { |rq, rs| rs.body="hello world" }; %w[TERM INT].each { |sig| trap(sig) { s.shutdown }}; s.start'
Comment by Pierre Schmitz (Pierre) - Saturday, 16 July 2011, 22:12 GMT
Maybe I don't see it, but the link you posted only defines an ipv4 address for localhost. I didn't find any source that prohibits a dual stack setup for localhost.
Comment by Tom Gundersen (tomegun) - Saturday, 23 July 2011, 19:34 GMT
I'm not able to reproduce. I ran the command given (the corrected one) with the standard /etc/hosts file, accessed "http://localhost:8001", which gave me "hello world". This is the output I get on the console:

% ruby -rwebrick -e 's=WEBrick::HTTPServer.new(:Port => 8001); s.mount_proc("/") { |rq, rs| rs.body="hello world" }; %w[TERM INT].each { |sig| trap(sig) { s.shutdown }}; s.start'
[2011-07-23 21:29:28] INFO WEBrick 1.3.1
[2011-07-23 21:29:28] INFO ruby 1.9.2 (2011-07-09) [x86_64-linux]
[2011-07-23 21:29:28] WARN TCPServer Error: Address family not supported by protocol - socket(2)
[2011-07-23 21:29:28] INFO WEBrick::HTTPServer#start: pid=3213 port=8001
localhost.localdomain - - [23/Jul/2011:21:29:41 CEST] "GET / HTTP/1.1" 200 11
- -> /
localhost.localdomain - - [23/Jul/2011:21:29:42 CEST] "GET /favicon.ico HTTP/1.1" 200 11
- -> /favicon.ico
^C[2011-07-23 21:31:24] INFO going to shutdown ...
[2011-07-23 21:31:24] INFO WEBrick::HTTPServer#start done.




Like Pierre, I don't understand exactly what you suggest we change. Could you post a suggestion to a new /etc/hosts file?
Comment by Csaba Henk (csheemea) - Saturday, 23 July 2011, 23:30 GMT
Please mark this invalid.

@tomegun: standard web clients do display "hello world", it's ab, the Apache Benchmark which fails.

WEBRick listens only on IPv4, that's why. And because ab is not about fault tolerancy -- if localhost can be reolved to ::1, it does not go further. Browsers work around not finding stuff on ::1 and check out the other possibility, ie. 127.0.0.1.

Pierre is right, dual stack is dandy ho. Yet it might be IRL that some services do not live up to that... but, sure thing, that's not a distro issue.

Sorry for consuming your time.
Comment by Tom Gundersen (tomegun) - Monday, 25 July 2011, 14:44 GMT
@csheemea: thanks for the clarification. I'll close this for now, but if there are real world apps that choke on this, then please open a new report and we can look into it.

Loading...