Bug 50484

Summary: Multiple calls to Ant script <sql> task fail with ojdbc5.jar
Product: Ant Reporter: Keith Davidson <keith>
Component: Core tasksAssignee: Ant Notifications List <notifications>
Status: NEW ---    
Severity: normal    
Priority: P2    
Version: 1.7.1   
Target Milestone: ---   
Hardware: Other   
OS: Linux   

Description Keith Davidson 2010-12-16 07:34:53 UTC
We are using an Ant script to apply SQL scripts to a database.  This is done using the core <sql> task within a macro passing the script as a parameter, ie

<sql driver="oracle.jdbc.driver.OracleDriver" url="@{url}" userid="@{user}" password="@{password}" classpathref="database.drivers" >
                                <transaction src="@{script}" />
                        </sql>

A controlling shell script calls several Ant targets (each with a new instance of Ant).  We have reproduced the problem just calling Ant several times from the shell.

The first call works fine but subsequent calls report

BUILD FAILED
.../build.xml:106: The following error occurred while executing this line:
.../build.xml:29: java.sql.SQLException: IO Error: Connection reset

After some delay (several minutes) running the same script works fine.

This does not seem related to the content of the SQL script - even simple select statements show this problem.

We have recently updated to use the newer Oracle ojdbc5.jar reverting back to the ojdbc14.jar fixes the problem.

We are using Ant 1.7.1 (but have reproduced the problem with 1.8.1)

Running on an Ubuntu server:
2.6.24-28-generic #1 SMP Wed Nov 24 09:30:14 UTC 2010 i686 GNU/Linux

Java version:
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)

The Oracle ojdbc5.jar reports its version as:
Oracle 11.2.0.2.0 JDBC 3.0 compiled with JDK5 on Sat_Aug_14_12:16:40_PDT_2010

The Oracle ojdbc14.jar fails to report its version - ie there is no manifest in that jar file.
Comment 1 Oleg 2011-08-18 13:19:58 UTC
We experienced the same problem when upgrading oracle drivers from 10.x to 11.2.0.2.

Issue could be resolved by adding -Djava.security.egd=file:///dev/urandom to jvm system properties by doing
export ANT_OPTS="-Djava.security.egd=file:///dev/urandom"
prior to running ant.

It is not specific to ant, but to jdbc driver which is now using /dev/random which doesn't have enough entropy on servers.
More info could be found in:
https://forums.oracle.com/forums/thread.jspa?messageID=3793101
http://www.usn-it.de/index.php/2009/02/20/oracle-11g-jdbc-driver-hangs-blocked-by-devrandom-entropy-pool-empty/