narakai / mdnsjava Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/mdnsjava
Automatically exported from code.google.com/p/mdnsjava
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
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:
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.