-
Notifications
You must be signed in to change notification settings - Fork 186
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
3.5.5 recover gets stuck in waiting for cancel and eventually exists with recover error #214
Comments
I think the problem is here
When send returns an IOException, advanceObjectsState isn't called, instead recoverTask is called on the Canceler, which stops, so HostInfoState never reaches cancelled. So if the canceller instead does (changed code) It works, but it doesn't seem right, perhaps JmDnsImpl should advance the state in
Instead of just returning? |
To repro just put a throw new IOException("fake") in JmDNSImpl.send instead of ms.send(packet) |
Another issue is that when going in and out of hibernate Linux can remove network interfaces and you get the exception "No such device", the only way out of that is to call
again before opening the socket in recover else you will get exception in recovering and the state machine will be stuck. |
It seems if you call closeMulticastSocket() on any exception in
before throwing the initial exception, recover won't get stuck |
It also thinks it has incorrectly recovered if this happens [local6.warni] 23:32:46,868 jmdns.impl.JmDNSImpl Creating multicast socket on interface name:eth0 (eth0) |
If you simulate network issues by adding a IOException in send you will notice the the JmDns won't finalize its recover state but instead call the delegate letting it now it couldn't recover, because, at least from what it seems, the canceller tasks won't finish (it is cancelled) so you are stuck in Cancel_1 or Cancel_2 (if you had a packet to send on first cancel)
These leave JmDns in a state where you can't restart it because the Timer/Task threads (2) are left running so you leak thread if you create a new instance. Obviously the current instance has stopped announcing and receiving as the multicast socket is closed in the recover code.
Need some help to figure out how to correct this as the state machine isn't obvious, but it seems to me the HostInfo state is deassociated incorrectly during cancel (or maybe not move to cancelled state when it happens).
The text was updated successfully, but these errors were encountered: