GithubHelp home page GithubHelp logo

generalelectric / snowizard-discovery Goto Github PK

View Code? Open in Web Editor NEW
19.0 19.0 18.0 342 KB

DEPRECATED - see https://github.com/dropwizard/dropwizard-discovery

Home Page: https://github.com/dropwizard/dropwizard-discovery

License: BSD 3-Clause "New" or "Revised" License

Java 100.00%

snowizard-discovery's People

Contributors

jplock avatar mchiodo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

snowizard-discovery's Issues

Configuration of listenAddress unexpected

Hey there,

we're trying out snowizard and stumbled across some strange behaviour: we're binding our dropwizard server to a certain ip address, and configured this address as listenAddress in the config file.

We were surprised to see that snowizard registered us in the zookeeper client under a different IP address (which exists locally, it was an IP from a virtual box interface).

Digging a bit in the code, we found this in the CuratorAdvertiser:

    public synchronized void initListenInfo(final int port) {
        try {
            final Collection<InetAddress> ips = ServiceInstanceBuilder
                    .getAllLocalIPs();
            if (Iterables.size(ips) > 0) {
                listenAddress = String.valueOf(Iterables.get(ips, 0))
                        .substring(1);
                LOGGER.debug("Found Local IP Addresses: {}, using {}", ips,
                        listenAddress);
            }
        } catch (final SocketException e) {
            LOGGER.error("Error getting local IP addresses", e);
        }

        if (Strings.isNullOrEmpty(listenAddress)) {
            LOGGER.debug("Using listenAddress from configuration file");
            listenAddress = configuration.getListenAddress();
        }

        listenPort = port;
    }

That shows that prior using the value from the configuration file, it seems to scan for local interfaces and just picks one of the IPs it found - and only uses the address from the configuration file in case no local IP address can be found (correct me in case I'm wrong here).

In my opinion, the listenAddress defined in the config should have a higher priority, but I realised that this cannot be easily changed, as - because of the 127.0.0.1 default value - it would always be set, hence just swapping the order in initListenInfo (only iterate through network interfaces in case there was no listenAddress defined in the config file) wouldn't work.

Did we understand the concept wrong, or might this be an actual issue? Is there no way to use the address dropwizard binds itself too? (I remember it was difficult / impossible to figure out as the bindHost configuration option gets hidden in a factory).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.