Thread: BUG #6494: Listening to * fails for IP V6
The following bug has been logged on the website: Bug reference: 6494 Logged by: Curd Reinert Email address: curd.reinert@ppi.de PostgreSQL version: 9.0.7 Operating system: AIX Description:=20=20=20=20=20=20=20=20 Hello everyone, on a AIX with IP V6 enabled, I try to listen on all interfaces listen_addresses =3D '*' and get=20 LOG: could not bind IPv6 socket: Der Socket-Name wird bereits verwendet. HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry. Of course I made sure there was nothing running on that port. I can then connect to the database using 127.0.0.1, but not with ::1. If instead I specify the IP addresses explictly, listen_addresses =3D '127.0.0.1,fdeb:df42:ebda:0815:0:0:0:18,::1' then there is no error and I can connect to all the addresses. 'localhost' instead of '*' also works, but I want to connect remotely. It's a 9.0.7 which was build on AIX 5.3 with readline, zlib and thread-safety disabled. The machine I originally tried to run it is a AIX 6.1. Symptoms on the 5.3 are the same.=20 We only have this trouble on AIX. We are already connection succesfully remotely over IP V6 to database running on Linux, Solaris, and Windows 7 (as far as I know). I didn't find anything useful in FAQ or TODO, I hope I didn't miss something obvious.=20 Many thanks, Curd
Hello again, since we've had similar trouble without own server sockets, I had a deeper look into this one. The trouble is that under AIX, once you have bound an IP V4 socket to a port, it seems you can't bind a IP V6 socket to the same port. The other way round works. And AIX seems to return addrinfo with IP V4 addresses in front. What I did is that I doubled the loop in pqcomm.c. In the first run, I only consider IP V6. In the second, I tried the rest. This worked, and I was able to connect to the IP V4 and the IP V6 address. Since it doesn't harm with other OSes to bind IP V6 first, does it seem to you like a sensible way of fixing this? Best regards, Curd Von: Curd Reinert/HH/PPI An: Curd Reinert/HH/PPI@PPI Datum: 27.02.2012 19:04 Betreff: Listening to * fails for IP V6 Hello everyone, on a AIX with IP V6 enabled, I try to listen on all interfaces listen_addresses = '*' and get LOG: could not bind IPv6 socket: Der Socket-Name wird bereits verwendet. HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry. Of course I made sure there was nothing running on that port. I can then connect to the database using 127.0.0.1, but not with ::1. If instead I specify the IP addresses explictly, listen_addresses = '127.0.0.1,fdeb:df42:ebda:0815:0:0:0:18,::1' then there is no error and I can connect to all the addresses. 'localhost' instead of '*' also works, but I want to connect remotely. It's a 9.0.7 which was build on AIX 5.3 with readline, zlib and thread-safety disabled. The machine I originally tried to run it is a AIX 6.1. Symptoms on the 5.3 are the same. We only have this trouble on AIX. We are already connection succesfully remotely over IP V6 to database running on Linux, Solaris, and Windows 7 (as far as I know). I didn't find anything useful in FAQ or TODO, I hope I didn't miss something obvious. Many thanks, Curd
Curd Reinert <Curd.Reinert@ppi.de> writes: > The trouble is that under AIX, once you have bound an IP V4 socket to a > port, it seems you can't bind a IP V6 socket to the same port. The other > way round works. And AIX seems to return addrinfo with IP V4 addresses in > front. Seems like that is a bug to file with IBM. > What I did is that I doubled the loop in pqcomm.c. In the first run, I > only consider IP V6. In the second, I tried the rest. This worked, and I > was able to connect to the IP V4 and the IP V6 address. > Since it doesn't harm with other OSes to bind IP V6 first, does it seem to > you like a sensible way of fixing this? No. Aside from the code uglification, it seems to me that trying addresses in an order different from the way that getaddrinfo returns them is very likely to expose other corner-case misbehaviors in other operating systems. Can you work around this with a suitable setting of listen_addresses? That is, explicitly specify the V6 and then V4 addresses there? regards, tom lane
pgsql-bugs-owner@postgresql.org schrieb am 29.02.2012 17:02:56: > Curd Reinert <Curd.Reinert@ppi.de> writes: > > The trouble is that under AIX, once you have bound an IP V4 socket to a > > port, it seems you can't bind a IP V6 socket to the same port. The other > > way round works. And AIX seems to return addrinfo with IP V4 addresses in > > front. > Seems like that is a bug to file with IBM. I agree. I will try to narrow it down to a simple example and send it to IBM. > code uglification, I agree with that one, too. > Can you work around this with a suitable setting of listen_addresses? > That is, explicitly specify the V6 and then V4 addresses there? Not really. Postgres is runnning at our customers sites, we don't know how there networks are configured, and we don't know if IP addresses may change. All we could do is describe the problem as a known bug when using AIX, IPV6 and postgres together and explain the workaround. Many thanks, Curd
Tom Lane wrote: >> The trouble is that under AIX, once you have bound an IP V4 socket to a >> port, it seems you can't bind a IP V6 socket to the same port. The other >> way round works. And AIX seems to return addrinfo with IP V4 addresses in >> front. > Seems like that is a bug to file with IBM. Indeed it does, and we did. Took us some time to persuade IBM to really check this, and some more time until we got an answer. The good news: they agree that the current behaviour is faulty, and they will change it. The not so good news: they can't predict when this fix will be available. If you happen to have an account at IBM, you can read more about IV23320 here: http://www-01.ibm.com/support/docview.wss?uid=isg1IV23320 Best regards, Curd Reinert
Hi Tom and everyone, > Seems like that is a bug to file with IBM. We did this 8 months ago, and we got a patch for the problem yesterday. As far as we can see it's really fixed - I only tested it with the showcase we built to convince IBM that there really is a problem, I haven't tried yet with postgres, but I'm pretty much convinced that it will work now. lslpp -l sh shows the following version information: bos.net.tcp.client 6.1.8.0 COMMITTED TCP/IP Client Support Thanks for your help, Curd