Giter VIP home page Giter VIP logo

mdnsjava's People

Contributors

posicks avatar

Watchers

 avatar

mdnsjava's Issues

Responses never get processed

What steps will reproduce the problem?
1. Have 3 network adapters (I have VMWare Installed which adds 2)
2. Run with '-B _myservice _tcp'  to find _myservice._tcp.local

Expected to see a ResolverListener receive the Message object, but it never 
does.

WireShark shows MDNS responses arriving at the correct port, the 
DatagramProcessor receives the packets, but the PacketRunner is never executed.

Using revision 62 on the trunk - 2.1.6 SNAPSHOT (maven). Windows 7 Pro.


The NetworkProcessor class has a ThreadPoolExecutor processorExecutor.  This 
will have two long-running threads for each network interface.  Executors.java 
has 'CORE_THREADS_NETWORK_EXECUTOR' set to 5.  This means that all 5 thread 
pools are filled by the NetworkProcessors for the three interfaces.  When a 
datagram Packet arrives, line 176 of DatagramProcessor.java attempts to run the 
PacketRunner to process the incoming mDNS response.  Since all 5 threads are 
currently running, no new thread starts up to process the incoming packet, and 
the response never arrives at higher levels of the application.

To temporarily fix, set the CORE_THREADS_NETWORK_EXECUTOR value equal to two 
times the number of network interfaces plus three - I set mine to 10.

To correct, perhaps have a different pool for PacketRunners than for the 
NetworkProcessor.

Original issue reported on code.google.com by [email protected] on 8 Apr 2015 at 5:59

Thread safety issue: NullpointerException in setCacheMonitor

What steps will reproduce the problem?
1. Service shutdown and discovery

What is the expected output? What do you see instead?
Gets NullpointerException in:
public void setCacheMonitor(CacheMonitor monitor);
at
executor.shutdown();

What version of the product are you using? On what operating system?
2.1.5

Please provide any additional information below:

Get NullpointerException in executor.shutdown() when
having broken out executor.shutdown into method: shutdownExecutor(). This 
implies thread safety issue. Consider synchronizing calls to 
executor.shutdown() in some way.
See following code and attached png image and java source file:

    /**
     * Sets the CacheMonitor used to monitor cache data. Can be used to
     * implement Cache record refreshing.
     * 
     * @param monitor the CacheMonitor
     */
    public void setCacheMonitor(CacheMonitor monitor)
    {
        cacheMonitor = monitor;
        synchronized (lock) {
            if (cacheMonitor == null) {
                if (executor != null) {
                    shutdownExecutor(); //Broken out!
                    executor = null; //Probably set to null here(?)
                }
            } else {
                if (executor != null) {
                    shutdownExecutor(); //Broken out!
                }
                executor = Executors.newScheduledThreadPool(1);
                executor.scheduleAtFixedRate(new MonitorTask(this, this.cacheMonitor), 1, 1, TimeUnit.SECONDS);
            }
        }
    }

    private void shutdownExecutor() { //This method was broken out from above!
        new Exception("TRACE").printStackTrace();

        executor.shutdown();
    }

This modification lead to NullpointerException, though code is basically the 
same.
In between 'if(executor != null)'-check and executor.shutdown(), executor may be
set to null by another thread.

I have attached a source file with proposed changes. Please note though that 
they were not seriously thought through. Issues may still exist (deadlock?), 
though the new code seems to work. Changes are marked with //TODO ...

Original issue reported on code.google.com by [email protected] on 15 May 2014 at 11:49

Attachments:

Great project

But it is sad, that original author do not migrate it to the github and don't 
upload to maven central repository, now exist many unofficial clones

https://github.com/search?utf8=%E2%9C%93&q=mdnsjava

Original issue reported on code.google.com by [email protected] on 15 Jun 2015 at 7:35

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.