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

Print a helpful message re: duplicate addresses #1910

Merged
merged 2 commits into from
Apr 1, 2016
Merged

Conversation

sean-
Copy link
Contributor

@sean- sean- commented Apr 1, 2016

IP sockets provide nice endpoints where the kernel will fail to bind and will error out saying socket already in use. UNIX sockets, however, don't enjoy this nice property when cleaning up stale sockets on listen. Given the number of addresses in Consul, provide operators with a helpful message that indicates the source of the reused address.

Before this fix, it was possible for the HTTP socket to unlink the RPC socket, leading to confusing blocked behavior when running commands like consul info.

% cat tmp.config.json
{
    "addresses": {
    "http": "unix:///tmp/.consul.sock",
    "rpc": "unix:///tmp/.consul.sock"
    },
    "unix_sockets": {
    "mode": "0700"
    }
}
% consul agent -config-file tmp.config.json -advertise=127.0.0.1 -data-dir=/tmp/
==> All listening endpoints must be unique: HTTP address already configured for RPC
Exit 1

IP sockets provide nice endpoints where the kernel will fail to bind and will error out saying socket already in use.  UNIX sockets, however, don't enjoy this nice property when cleaning up stale sockets on listen.  Given the number of addresses in Consul, provide operators with a helpful message that indicates the source of the reused address.

Before this fix, it was possible for the HTTP socket to unlink the RPC socket, leading to confusing blocked behavior when running commands like `consul info`.

```
% cat tmp.config.json
{
    "addresses": {
	"http": "unix:///tmp/.consul.sock",
	"rpc": "unix:///tmp/.consul.sock"
    },
    "unix_sockets": {
	"mode": "0700"
    }
}
% consul agent -config-file tmp.config.json -advertise=127.0.0.1 -data-dir=/tmp/
==> All listening endpoints must be unique: HTTP address already configured for RPC
Exit 1
```
const numUniqueAddrs = 7
m := make(map[key]string, numUniqueAddrs)

testFunc := func(k key, descr string) (bool, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bool here is redundant with the error - just return a nil error I think.

@slackpad
Copy link
Contributor

slackpad commented Apr 1, 2016

One tiny tweak, otherwise LGTM.

@sean- sean- merged commit 140cde6 into master Apr 1, 2016
@sean- sean- deleted the f-detect-dupe-addrs branch April 1, 2016 17:35
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

Successfully merging this pull request may close these issues.

None yet

2 participants