2017-02-23 05:42 CET

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0003052MPDAudio Output - httpdpublic2011-03-19 21:22
Assigned Tocirrus 
Platformx86OSLinux (Ubuntu Server)OS Version2.6.32-25
Product Versiongit 
Target VersionFixed in Versiongit 
Summary0003052: Enabling httpd output causes MPD to exit
DescriptionUsing httpd output is not possible, due to what looks like an IPv6 problem, on my Ubuntu 10.04 machine. When the output is commented out, the server starts fine. When included in the configuration, it fails with the following message:

output: line 227: Failed to look up host "::": Address family for hostname not supported

This configuration has not changed. It was working until very recently (failed within the last week or two). I am using the PPA repository, which is currently at version: 0.16~alpha2+git20100928.e10b872-0ubuntu1~ripps1~lucid
Steps To ReproduceAdd (or uncomment, then modify) the following to mpd.conf:
audio_output {
    type "httpd"
    name "The Ronalds"
    encoder "vorbis" # optional, vorbis or lame
    port "8000"
    quality "5.0" # do not define if bitrate is defined
# bitrate "128" # do not define if quality is defined
    format "44100:16:2"

Start mpd:

# mpd --no-daemon --stderr -vv
config: loading file /etc/mpd.conf
listen: binding to address for
listen: binding to socket address
path: path_set_fs_charset: fs charset is: UTF-8
database: reading DB
output: line 227: Failed to look up host "::": Address family for hostname not supported
Additional InformationSince this is networking based, here are my interfaces:

br0 Link encap:Ethernet HWaddr 00:30:18:a4:e2:88
          inet addr: Bcast: Mask:
          inet6 addr: fe80::230:18ff:fea4:e288/64 Scope:Link
          RX packets:178162 errors:0 dropped:0 overruns:0 frame:0
          TX packets:204772 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:84591199 (84.5 MB) TX bytes:175704863 (175.7 MB)

eth2 Link encap:Ethernet HWaddr 00:30:18:a4:e2:88
          inet6 addr: fe80::230:18ff:fea4:e288/64 Scope:Link
          RX packets:45161 errors:0 dropped:0 overruns:0 frame:0
          TX packets:42248 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:36162866 (36.1 MB) TX bytes:3512257 (3.5 MB)
          Interrupt:18 Base address:0xa000

eth3 Link encap:Ethernet HWaddr 00:30:18:a4:e2:89
          inet6 addr: fe80::230:18ff:fea4:e289/64 Scope:Link
          RX packets:148086 errors:0 dropped:0 overruns:0 frame:0
          TX packets:177734 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:60217535 (60.2 MB) TX bytes:181493648 (181.4 MB)
          Interrupt:19 Base address:0xe000

lo Link encap:Local Loopback
          inet addr: Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING MTU:16436 Metric:1
          RX packets:1148 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1148 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:159647 (159.6 KB) TX bytes:159647 (159.6 KB)

pan0 Link encap:Ethernet HWaddr 5a:e1:9e:3e:e4:85
          BROADCAST MULTICAST MTU:1500 Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

Configuration file mpd.conf is attached.
TagsNo tags attached.
Attached Files
  • ? file icon mpd.conf (12,598 bytes) 2010-10-04 00:25

has duplicate 0003057closedcirrus MPD fails to run with HTTPD enabled 'Failed to look up host "::": Address family for hostname not supported' 



mithi (reporter)

I recently added IPv6 support and a "bind_to_address" option to the httpd output plugin. As a workaround, you could try to add the following line to the httpd output section:

bind_to_address ""

This disables IPv6 supports and listens on any IPv4 address, which was the default prior to the change.

I'm quite surprised though that you get this error message. "::" is the default value if you have no bind_to_address specified, if at compile-time you had IPv6 support. What's baffling is that your Linux obviously supports IPv6 (looking a the addresses of the ethernet interfaces) but refuses to resolve "::" correctly.


cirrus (administrator)

mithi, this is not surprising at all. Having IPv6 support at compile time does not mean that it's available at runtime. We pass the option AI_ADDRCONFIG which makes getaddrinfo() care for what's really available. Using an IPv6 address like "::" will lead to an error if IPv6 is not available.

You better reuse the code from listen.c, instead of rolling your own. It is very hard to get that right, and one should better use known-good solutions.


Brianetta (reporter)

The work-around suggested does work.


mithi (reporter)

Last edited: 2010-10-04 22:29

View 2 revisions

There is no code in listen.c that does what httpd needs. The main difference is that httpd doesn't immediately create a socket but delays opening the socket until the plugin is opened, which in particular means that we can't reuse the listen_add_port*-functions.

I agree that it's bad behavior to break existing configs (without a specified bind_to_address). It's basically just a question of what the default should be. On the one hand we could argue that since IPv4-only was the previous default, we should stick to IPv4-only with unconfigured bind_to_address. On the other hand we could argue that the default should be to support as much as possible, which would be IPv6 if available. But that raises the question of what to do on dual-stack systems, where "::" doesn't include IPv4-mapped addresses. This is however not my call to make. The former would be a really simple patch, the latter would require a fallback mechanism which shouldn't be so hard to devise.

Edit: This however doesn't explain why IPv6 isn't available even though the interfaces clearly have IPv6 link-local addresses assigned.


cirrus (administrator)

listen.c is not generic enough, but it can be made so. This was the main reason I hadn't implemented that patch yet; I wanted to clean up listen.c first. If you reimplement it instead (without learning from it), you are doomed to repeat the same mistakes listen.c had in its early days.


mithi (reporter)

Then please revert my patch, so it won't cause trouble for other users.

-Issue History
Date Modified Username Field Change
2010-10-04 00:25 Brianetta New Issue
2010-10-04 00:25 Brianetta Status new => assigned
2010-10-04 00:25 Brianetta Assigned To => cirrus
2010-10-04 00:25 Brianetta File Added: mpd.conf
2010-10-04 21:20 mithi Note Added: 0006166
2010-10-04 21:25 cirrus Note Added: 0006167
2010-10-04 21:57 Brianetta Note Added: 0006168
2010-10-04 22:27 mithi Note Added: 0006169
2010-10-04 22:29 mithi Note Edited: 0006169 View Revisions
2010-10-04 22:39 cirrus Note Added: 0006170
2010-10-04 23:03 mithi Note Added: 0006171
2010-10-05 21:24 cirrus Status assigned => resolved
2010-10-05 21:24 cirrus Fixed in Version => git
2010-10-05 21:24 cirrus Resolution open => fixed
2010-10-06 12:56 cirrus Relationship added has duplicate 0003057
2011-03-19 21:22 Avuton Olrich Status resolved => closed
+Issue History