Bug 44236 - IsReachable Issue
Summary: IsReachable Issue
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.7.0
Hardware: All Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-14 20:37 UTC by ZW
Modified: 2008-01-15 01:45 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ZW 2008-01-14 20:37:42 UTC
Z W wrote:
> Hi
>
> I'm trying to "ping" hosts on network using <isreachable> with ant-contrib.
> All these hosts variables point to the same host ie linpac2.

>

> [echo] start isreachable linpac2
>
> Dynamically discovered 'isreachable'
> org.apache.tools.ant.taskdefs.condition.IsReachable@1f3aa07
>
> Probing host linpac2
>
> Unknown host: linpac2
>
> Condition false; not setting offline
>
> [echo] build_main.debug=0
>
> [sleep] sleeping for 5000 milliseconds
>
> Why on both consecutive "pinging" to the same host, it works the first time
> but not the second ?
>


I'm the author of that task, so blame me.
Here's the source
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskd
efs/condition/IsReachable.java?view=markup

-isreachable uses Sun's API InetAddress.isReachable() , the exact
behaviour of which is undocumented (they dont say how it pings)

If its playing up, its probably the implementation. I see that java 6.4
mentions three fixes for this

6587875         java    classes_net     InetAddress.isReachable() will not 
work for
super users with "large" process ids
6599750         java    classes_net     InetAddress.isReachable implementation 
not
completely thread safe
6601686         java    classes_net     InetAddress.isReachable(timeout) may 
not
return after timout milliseconds

1. please open a bugrep on issues.apache.org/bugzilla
2. try with the latest sun JVM update; if it goes away, then we've found
the problem

I've found I dont use the condition much, because
 -some of the hosts I deploy to have ping locked down
 -it doesnt go through firewalls
 -when a machine is booting up, ping starts ahead of the services I need

I prefer to use <http> and <socket>. Could they work for you ?
Comment 1 Steve Loughran 2008-01-15 01:45:27 UTC
ZW 

-try upgrading to java 1.6.0_04, which has some documented changes to the
IsReachable() code