Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pgwire cannot bind to IPV4 "all-addresses" #3962

Closed
knz opened this issue Jan 25, 2016 · 9 comments
Closed

pgwire cannot bind to IPV4 "all-addresses" #3962

knz opened this issue Jan 25, 2016 · 9 comments
Milestone

Comments

@knz
Copy link
Contributor

knz commented Jan 25, 2016

Without any arguments, pgwire listens only on [::]:15432 (ipv6 all-addresses).

With --pgaddr 0.0.0.0:15432 (ipv4 all-ddresses), the configuration is ignored and it starts listening on [::]:15432 as well.

Only with an explicit ipv4 address (eg. --pgaddr x.y.z.w:15432) does the desired behavior appear.

I think this is rather new as I did not have this problem last week.

There are two bugs in here:

  1. --pgaddr 0.0.0.0:15432 should really listen on ipv4
  2. by default (no argument) pgwire should probably listen on both ipv4 and ipv6 or the current behavior should be clearly outlined in the doc.
@tamird
Copy link
Contributor

tamird commented Jan 25, 2016

cc @mberhault

@knz
Copy link
Contributor Author

knz commented Jan 25, 2016

(Via @tamird) might be related to #3757

@knz
Copy link
Contributor Author

knz commented Jan 25, 2016

Ok after some more investigation this issue is not reallyn related to the argument --pgaddr but more to the general behavior of net.Listen when provided these values as input. What is the general way in Go to specify the "any" binding for ipv4?

@knz knz added this to the Beta milestone Jan 29, 2016
@knz knz added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. and removed C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. labels Jan 29, 2016
@knz
Copy link
Contributor Author

knz commented Jan 29, 2016

Found while investigating #4036

@maddyblue
Copy link
Contributor

@maddyblue
Copy link
Contributor

@knz can you replicate this on a Mac? I dived in a bit and it seems like Go thinks it's a ipv4 address. Linux may be doing some auto ipv6 magic.

@bdarnell
Copy link
Contributor

bdarnell commented Feb 3, 2016

I'm not sure exactly how the system calls are exposed via go, but I've run into this in the past. In short, linux likes to bind to both ipv4 and ipv6 together whenever it can, while BSD and OSX require them to be bound separately. To handle things in a sane and cross-platform way you have to pass extra socket options on linux to make it act more like BSD. This seems like something Go should handle for us instead of something we do at our level.

@knz
Copy link
Contributor Author

knz commented Feb 7, 2016

The issue was found and was affecting a Linux system.
The issue has gone away after upgrading to 4fc0779.
Closing this issue for now, if found again on BSD/OSX another issue could be opened too.

@knz knz closed this as completed Feb 7, 2016
@tamird
Copy link
Contributor

tamird commented Feb 7, 2016

This was (unintentionally) fixes in #4161.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants