Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Network Health is reporting all IPs as reachable in items definitions (Windows 10) #4245

Closed
lonelydime opened this issue Mar 30, 2016 · 8 comments

Comments

@lonelydime
Copy link

lonelydime commented Mar 30, 2016

This is a problem in Windows 10, running the same configs in Ubuntu 14 and 15 worked fine (Ubuntu ran OpenJDK, Windows is running Oracle Java 1.8_077). I have 4 mobile devices set up in the items definitions, each with its own static IP address which is what Network Health is using to determine presence. The problem I'm running into is each IP is registering as ON even though those IP addresses are not assigned. I temporarily disabled Windows Firewall to make sure there were no firewall issues. I'm also running MySQL presistance and all 4 phones are being saved on change, every hour and restore on startup. Running a ping in CMD returns the following for an attached and a detached device:

Pinging 192.168.1.20 with 32 bytes of data:
Reply from 192.168.1.20: bytes=32 time=579ms TTL=64
Reply from 192.168.1.20: bytes=32 time=594ms TTL=64
Reply from 192.168.1.20: bytes=32 time=611ms TTL=64
Reply from 192.168.1.20: bytes=32 time=632ms TTL=64

Pinging 192.168.1.21 with 32 bytes of data:
Reply from 192.168.1.x: Destination host unreachable.
Reply from 192.168.1.x: Destination host unreachable.
Request timed out.
Reply from 192.168.1.x: Destination host unreachable.

This is what the OpenHAB logger displays:

2016-03-30 07:27:33.254 [DEBUG] [o.o.b.n.i.NetworkHealthBinding] - established connection [host '192.168.1.24' port '0' timeout '5000']
2016-03-30 07:27:36.254 [DEBUG] [o.o.b.n.i.NetworkHealthBinding] - established connection [host '192.168.1.23' port '0' timeout '5000']
2016-03-30 07:27:36.805 [DEBUG] [o.o.b.n.i.NetworkHealthBinding] - established connection [host '192.168.1.21' port '0' timeout '5000']
2016-03-30 07:27:36.945 [DEBUG] [o.o.b.n.i.NetworkHealthBinding] - established connection [host '192.168.1.20' port '0' timeout '5000']

Here are my configs and relevant rules:

openhab.cfg

########################### NetworkHealth Binding #####################################
#
# Default timeout in milliseconds if none is specified in binding configuration
# (optional, default to 5000)
networkhealth:timeout=5000

# refresh interval in milliseconds (optional, default to 60000)
networkhealth:refresh=15000

# Cache the state for n minutes so only changes are posted (optional, defaults to 0 = disabled)
# Example: if period is 60, once per hour the online states are posted to the event bus;
#          changes are always and immediately posted to the event bus.
# The recommended value is 60 minutes.
networkhealth:cachePeriod=60

items

Switch PHONE1 "Phone1" (gMobiles) {nh="192.168.1.20"} 
Switch PHONE2 "Phone2" (gMobiles) {nh="192.168.1.21"} 
Switch PHONE3 "Phone3" (gMobiles) {nh="192.168.1.23"} 
Switch PHONE4 "Phone4" (gMobiles) {nh="192.168.1.24"}

rules

rule "Periodically check Presence"
when
    Time cron "0 */5 * * * ?"
then
    //If phone is on wifi
    if (PHONE1.state == ON) {
        someoneIsHome = true
        minutesGone = 0
    }
    else {
        var Number phone1GoneMinutes = PRESENCE_PHONE1_GONE.state
        phone1GoneMinutes = phone1GoneMinutes + 5
        PRESENCE_PHONE1_GONE.postUpdate(phone1GoneMinutes)
    }
    if (PHONE2.state == ON) {
        someoneIsHome = true
        minutesGone = 0
    }
    else {
        var Number phone2GoneMinutes= PRESENCE_PHONE2_GONE.state
        phone2GoneMinutes= phone2GoneMinutes+ 5
        PRESENCE_PHONE2_GONE.postUpdate(phone2GoneMinutes)
    }
end

rule "phone 1 connects"
when
    Item PHONE1 changed from OFF to ON
then
    var phone1AwayTime = PRESENCE_PHONE1_GONE.state

    PRESENCE_PHONE1_GONE.postUpdate(0)

    if (phone1AwayTime >= 45) {
        phone1ComingHome = true
    }
end

rule "phone 2 connects"
when
        Item PHONE2 changed from OFF to ON
then
        var phone2AwayTime = PRESENCE_PHONE2_GONE.state

        PRESENCE_PHONE2_GONE.postUpdate(0)

        if (phone2AwayTime >= 45) {
                phone2ComingHome = true
        }
end

sitemap

Switch item=PHONE1 label="Phone1" mappings=[ON="On",OFF="Off"]
Switch item=PHONE2 label="Phone2" mappings=[ON="On",OFF="Off"]
Switch item=PHONE3 label="Phone3" mappings=[ON="On",OFF="Off"]
Switch item=PHONE4 label="Phone4" mappings=[ON="On",OFF="Off"]

persist

gMobiles* : strategy = everyChange, everyHour, restoreOnStartup

@steve-bate steve-bate changed the title Network Health is reporting all IPs as reachable in items definitions Network Health is reporting all IPs as reachable in items definitions (Windows 10) Apr 6, 2016
@steve-bate
Copy link
Contributor

@lonelydime This would almost have to be a Java bug since NetworkHealth uses Java's InetAddress.getByName(host).isReachable(timeout)in this case. Just curious, have you tried the ping action from a rule to see if it gives the same results?

@TomC13
Copy link

TomC13 commented Apr 18, 2016

This issue also appears on Windows 8.1 and started after 3/31/2016 for me. Java runtime was updated to 1.8.0_77 on 4/1/2016.

@laurensl2
Copy link

I'm experiencing the same issue on Windows 7 machine
When i check logs i see problem started on 29/04/2016
Downgrading java solved the problem

@gumulka
Copy link
Contributor

gumulka commented Jun 3, 2016

It might be the case, that the new Java does not throw an error, but instead returns a false value.
If no error is throw, the network is said to be reachable, even though it is not.

@pallemannen
Copy link

I can add that I experience the same problem in Windows 2008 R2 with Oracle Java 1.8.0_77.

@WiredLife
Copy link

WiredLife commented Oct 5, 2016

Same problem here with Windows 10 Pro x64 and Java 1.8.0_102-b14.
Waiting for a fix :(

Edit:
I did downgrading many versions and see the problem exists since update 74.
Now using update 73 and everything is fine.
But this is not a solution because of security reasons, please fix the addon.

@9037568
Copy link
Contributor

9037568 commented Mar 15, 2017

This ticket appears to indicate this is a a JDK bug that has been fixed in build 138.

@9037568
Copy link
Contributor

9037568 commented Jan 26, 2020

Closing due to inactivity

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants