ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: Bug: waitfor waits too long, too slow
Date Tue, 17 Apr 2007 09:09:28 GMT
Berglas, Anthony wrote:
> Hello All,
> 
> I have the following fragment in a build that restarts tomcat
>         <waitfor>
>             <not>
>                 <socket server="dbserver" port="8080"/>
>             </not>
>         </waitfor>
> 
> The trouble is that it takes about 30 seconds to run, even if Tomcat has
> not run for a while, and there is nothing port 8080 at all.  
> 
> This is on Windows XP.
> 
> Setting checkevery does not help.
> 
> The following netstats were done before, during (two) and after the
> waitfor.  
> 
> C:\Documents and Settings\aberglas>netstat -ao | findstr 8080
> 
> C:\Documents and Settings\aberglas>netstat -ao | findstr 8080
>   TCP    aberglas-pc:2520       10.16.172.13:8080      SYN_SENT
> 2444
> 
> C:\Documents and Settings\aberglas>netstat -ao | findstr 8080
>   TCP    aberglas-pc:2520       10.16.172.13:8080      SYN_SENT
> 2444
> 
> C:\Documents and Settings\aberglas>netstat -ao | findstr 8080
> 
> (If Tomcat had been run recently, there can be some TIME_WAITS as well,
> but I think that that is quite irrelevant.  In any case the problem is
> still there if there are no TIME_WAITS as demonstrated above.)
> 
> Feels like this is a bug, in ant or windows.  I've needed to replace
> waitfor with a sleep, which is unfortunate.  Any help appreciated

It could be a quirk of networking -30s sounds like a timeout on the lan, 
and the SYN_SENT packet implies it isnt DNS that is causing the delay.

If your server has a firewall and is dropping all incoming packets, then 
the build wont know that the socket isnt there until it gives up.

1. test with a manual "telnet dbserver 8080" and see how long that takes 
to terminate. A quick rejection=good, 30s delay=bad

2. try opening the firewall on that port, so that the manual telnet 
fails fast, instead of slow

3. maybe we could fiddle with socket.setSoTimeout in the condition, but 
this is only something that could be done in a future version of ant. 
you are best off fixing your firewall.




> A related feature request, is that it would be good to be able to wait
> for a file lock to be removed on windows.  Or to be able to put a time
> out on delete.

well, if you can find a way to reliably implement it, I'm sure we could 
add a new condition.

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


Mime
View raw message