posicks / mdnsjava

Multicast DNS (mDNS) [RFC 6762] & DNS-Based Service Discovery (DNS-SD) [RFC6763] in Java
http://posicks.github.io/mdnsjava/
110 stars 43 forks source link

Responses never get processed #2

Closed GoogleCodeExporter closed 7 years ago

GoogleCodeExporter commented 9 years ago
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 jpro...@gmail.com on 8 Apr 2015 at 5:59

posicks commented 7 years ago

Eliminated need for CORE_THREADS_NETWORK_EXECUTOR value