You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Z W <mp...@gmail.com> on 2008/01/12 03:27:10 UTC

Isreachable issue

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.

<ac:for list="${sunmdm_ap1_hostname},

${sunmdm_ap2_hostname},${sunref_ap1_hostname},

${sunref_ap2_hostname},${sunmdm_db1_hostname},

${sunmdm_db2_hostname},${sunref_db1_hostname},

${sunref_db2_hostname},${sunmdm_lg1_hostname},

${sunmdm_lg2_hostname},${sunref_lg1_hostname},

${sunref_lg2_hostname}" param="letter">

<ac:sequential>

<echo> start isreachable @{letter}</echo>

<condition property="offline" value="0">

<isreachable host="@{letter}" timeout="10000"/>

</condition>

<echo level="verbose"> build_main.debug=${offline}</echo>

<sleep hours="0" minutes="0" seconds="5" milliseconds="0" />

</ac:sequential>

</ac:for>

When I ran this I get for example -

[echo] start isreachable linpac2

Dynamically discovered 'isreachable'
org.apache.tools.ant.taskdefs.condition.IsReachable@97a560

Probing host linpac2

Host address = 192.168.126.192

host is reachable

Condition true; setting offline to 0

Override ignored for property "offline"

[echo] build_main.debug=0

[sleep] sleeping for 5000 milliseconds



[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 ?



When I do this:

<condition property="offline" value="0">

<isreachable host="${sunmdm_ap1_hostname}" timeout="10000"/>

</condition>

<condition property="offline" value="0">

<isreachable host="${sunmdm_ap2_hostname}" timeout="10000"/>

</condition>

it worked fine.

Any help is appreciated

Re: Isreachable issue

Posted by Steve Loughran <st...@apache.org>.
Z W wrote:
> Hi Steve
> 
> I'm not sure what's the latest patch/update you talk about.
> My settings are as follows:
> 
> -------------------------------------------
>  System properties
> -------------------------------------------
> java.runtime.name : Java(TM) SE Runtime Environment
> sun.boot.library.path : C:\Program Files\Java\jdk1.6.0_03\jre\bin
> java.vm.version : 1.6.0_03-b05


1. there is an update 1.6.0_04, with changes to IsReachable.

2. If IsReachable doesnt behave, its really out of our hands, as there 
is little we do
-- 
Steve Loughran                  http://www.1060.org/blogxter/publish/5
Author: Ant in Action           http://antbook.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Isreachable issue

Posted by Z W <mp...@gmail.com>.
Hi Steve

I'm not sure what's the latest patch/update you talk about.
My settings are as follows:

-------------------------------------------
 System properties
-------------------------------------------
java.runtime.name : Java(TM) SE Runtime Environment
sun.boot.library.path : C:\Program Files\Java\jdk1.6.0_03\jre\bin
java.vm.version : 1.6.0_03-b05
ant.library.dir : C:\apache-ant-1.7.0\lib
java.vm.vendor : Sun Microsystems Inc.
java.vendor.url : http://java.sun.com/
path.separator : ;
java.vm.name : Java HotSpot(TM) Client VM
file.encoding.pkg : sun.io
user.country : US
sun.java.launcher : SUN_STANDARD
sun.os.patch.level : Service Pack 2
java.vm.specification.name : Java Virtual Machine Specification
java.runtime.version : 1.6.0_03-b05
java.awt.graphicsenv : sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs : C:\Program Files\Java\jdk1.6.0_03\jre\lib\endorsed
os.arch : x86
java.io.tmpdir : C:\DOCUME~1\ZACHAR~1\LOCALS~1\Temp\
line.separator :
java.vm.specification.vendor : Sun Microsystems Inc.
user.variant :
os.name : Windows XP
ant.home : C:\apache-ant-1.7.0
sun.jnu.encoding : Cp1252
java.specification.name : Java Platform API Specification
java.class.version : 50.0
sun.management.compiler : HotSpot Client Compiler
os.version : 5.1
java.awt.printerjob : sun.awt.windows.WPrinterJob
file.encoding : Cp1252
java.specification.version : 1.6
java.class.path : C:\apache-ant-1.7.0\lib\ant-launcher.jar;C:\apache-
ant-1.7.0\l
ib\activation.jar;C:\apache-ant-1.7.0\lib\ant-antlr.jar;C:\apache-
ant-1.7.0\lib\
ant-apache-bcel.jar;C:\apache-ant-1.7.0\lib\ant-apache-bsf.jar;C:\apache-
ant-1.7
.0\lib\ant-apache-log4j.jar;C:\apache-ant-1.7.0\lib\ant-apache-oro.jar
;C:\apache
-ant-1.7.0\lib\ant-apache-regexp.jar;C:\apache-
ant-1.7.0\lib\ant-apache-resolver
.jar;C:\apache-ant-1.7.0\lib\ant-commons-logging.jar;C:\apache-
ant-1.7.0\lib\ant
-commons-net.jar;C:\apache-ant-1.7.0\lib\ant-contrib-1.0b3.jar;C:\apache-
ant-1.7
.0\lib\ant-jai.jar;C:\apache-ant-1.7.0\lib\ant-javamail.jar;C:\apache-
ant-1.7.0\
lib\ant-jdepend.jar;C:\apache-ant-1.7.0\lib\ant-jmf.jar;C:\apache-
ant-1.7.0\lib\
ant-jsch.jar;C:\apache-ant-1.7.0\lib\ant-junit.jar;C:\apache-
ant-1.7.0\lib\ant-l
auncher.jar;C:\apache-ant-1.7.0\lib\ant-netrexx.jar;C:\apache-
ant-1.7.0\lib\ant-
nodeps.jar;C:\apache-ant-1.7.0\lib\ant-starteam.jar;C:\apache-
ant-1.7.0\lib\ant-
stylebook.jar;C:\apache-ant-1.7.0\lib\ant-swing.jar;C:\apache-
ant-1.7.0\lib\ant-
testutil.jar;C:\apache-ant-1.7.0\lib\ant-trax.jar;C:\apache-
ant-1.7.0\lib\ant-we
blogic.jar;C:\apache-ant-1.7.0\lib\ant.jar;C:\apache-
ant-1.7.0\lib\commons-net-1
.4.1.jar;C:\apache-ant-1.7.0\lib\jakarta-oro-2.0.8.jar;C:\apache-
ant-1.7.0\lib\j
sch-0.1.36.jar;C:\apache-ant-1.7.0\lib\mail.jar;C:\apache-
ant-1.7.0\lib\xercesIm
pl.jar;C:\apache-ant-1.7.0\lib\xml-apis.jar;C:\Program
Files\Java\jdk1.6.0_03\li
b\tools.jar
java.vm.specification.version : 1.0
sun.arch.data.model : 32
java.home : C:\Program Files\Java\jdk1.6.0_03\jre
java.specification.vendor : Sun Microsystems Inc.
user.language : en
awt.toolkit : sun.awt.windows.WToolkit
java.vm.info : mixed mode, sharing
java.version : 1.6.0_03
java.ext.dirs : C:\Program
Files\Java\jdk1.6.0_03\jre\lib\ext;C:\WINDOWS\Sun\Jav
a\lib\ext
sun.boot.class.path : C:\Program
Files\Java\jdk1.6.0_03\jre\lib\resources.jar;C:
\Program Files\Java\jdk1.6.0_03\jre\lib\rt.jar;C:\Program
Files\Java\jdk1.6.0_03
\jre\lib\sunrsasign.jar;C:\Program
Files\Java\jdk1.6.0_03\jre\lib\jsse.jar;C:\Pr
ogram Files\Java\jdk1.6.0_03\jre\lib\jce.jar;C:\Program
Files\Java\jdk1.6.0_03\j
re\lib\charsets.jar;C:\Program Files\Java\jdk1.6.0_03\jre\classes
java.vendor : Sun Microsystems Inc.
file.separator : \
java.vendor.url.bug : http://java.sun.com/cgi-bin/bugreport.cgi
sun.cpu.endian : little
sun.io.unicode.encoding : UnicodeLittle
sun.desktop : windows
sun.cpu.isalist : pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386
i86
Should I still go ahead and log the defect ?



Steve,
Would you help answer my other question concerning property setting using
antcallback with antfile.
I can't seem to be able to retrieve the property from antcallback,

Appreciate your contribution.





On Jan 14, 2008 2:23 AM, Steve Loughran <st...@apache.org> wrote:

> 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/taskdefs/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.isReachableimplementation 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 ?
>
> --
> Steve Loughran                  http://www.1060.org/blogxter/publish/5
> Author: Ant in Action           http://antbook.org/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Re: Isreachable issue

Posted by Steve Loughran <st...@apache.org>.
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/taskdefs/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 ?

-- 
Steve Loughran                  http://www.1060.org/blogxter/publish/5
Author: Ant in Action           http://antbook.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org