title: Spring batch hangs with no status update
body: <p>I initiated my spring batch job ( which has 16 steps) last evening around 6:00pm. Since it is the first time run, I expected it to take a few hours and completed by this morning. However, the job hung after reading and writing about 1 million records in the first step. I have put in a mechanism to restart the job in case the job fails based on the job status. 
  However, </p>
  
  <ul>
  <li>the job status in the BATCH_JOB_EXECUTION table shows status="STARTED" with exit-code="UNKNOWN"</li>
  <li>the step status in the BATCH_STEP_EXECUTION shows status = "STARTED" and exit-code="EXECUTING"</li>
  </ul>
  
  <p>How do I terminate the job gracefully in this scenario, so that it can be restarted? Is that the optimal way of handling this scenario ?</p>
  
  <p>Am I missing any  configuration attributes ? Should I set up any additional attribute ?
  My datasource configuration is as follows :</p>
  
  <pre><code>&lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"&gt;
              &lt;property name="driverClassName" value="com.informix.jdbc.IfxDriver"/&gt;
              &lt;property name="url" value="&lt;DBURL&gt;" /&gt;
              &lt;property name="username" value="&lt;USERID&gt;"  /&gt;
              &lt;property name="password" value="&lt;PASSWORD&gt;" /&gt;
              &lt;property name="initialSize" value="25" /&gt;
              &lt;property name="maxIdle" value="15" /&gt; &lt;!-- maxIdle..The maximum number of connections that should be kept in the pool at all times. Idle connections are checked periodically (if enabled) and connections that have been idle for longer than minEvictableIdleTimeMillis are released. See also testWhileIdle. --&gt;
              &lt;property name="minIdle" value="5" /&gt;&lt;!-- minIdle...The minimum number of established connections that should be kept in the pool at all times. The connection pool can shrink below this number if validation queries fail. The default value is derived from initialSize. --&gt;
              &lt;property name="maxActive" value="20" /&gt; &lt;!-- maxActive..The maximum number of active connections that can be allocated from this pool at the same time, or negative for no limit. --&gt;
              &lt;property name="maxWait" value="3000" /&gt; &lt;!-- maxWait..The maximum milliseconds a pool with no available connections will wait for a connection to be returned before throwing an exception, or -1 to wait indefinitely. --&gt;
              &lt;property name="removeAbandonedTimeout" value="2700" /&gt; &lt;!--removeAbandonedTimeout..Setting 15 minuts. Timeout in seconds before an abandoned connection can be removed. The value should be set to the longest running query your applications might have. --&gt;
              &lt;property name="logAbandoned" value="true" /&gt; &lt;!--logAbandoned.. Set to true to log stack traces for application code that abandons a Connection. Logging an abandoned Connection adds overhead for every Connection open because a stack trace has to be generated. --&gt;
              &lt;property name="idleConnectionTestPeriod" value="300" /&gt;    Test all connections in the pool every 5 minutes using the preferredTestQuery above --&gt;
      &lt;/bean&gt;
  
      &lt;bean id="readerdataSource" class="org.apache.commons.dbcp.BasicDataSource"&gt;
              &lt;property name="driverClassName" value="com.informix.jdbc.IfxDriver"/&gt;
              &lt;property name="url" value="&lt;DBURL&gt;" /&gt;
              &lt;property name="username" value="&lt;USERID&gt;"  /&gt;
              &lt;property name="password" value="&lt;PASSWORD&gt;" /&gt;
              &lt;property name="defaultReadOnly" value="true" /&gt;
              &lt;property name="initialSize" value="25" /&gt;
              &lt;property name="maxIdle" value="15" /&gt; &lt;!-- maxIdle..The maximum number of connections that should be kept in the pool at all times. Idle connections are checked periodically (if enabled) and connections that have been idle for longer than minEvictableIdleTimeMillis are released. See also testWhileIdle. --&gt;
              &lt;property name="minIdle" value="5" /&gt;&lt;!-- minIdle...The minimum number of established connections that should be kept in the pool at all times. The connection pool can shrink below this number if validation queries fail. The default value is derived from initialSize. --&gt;
              &lt;property name="maxActive" value="20" /&gt; &lt;!-- maxActive..The maximum number of active connections that can be allocated from this pool at the same time, or negative for no limit. --&gt;
              &lt;property name="maxWait" value="3000" /&gt; &lt;!-- maxWait..The maximum milliseconds a pool with no available connections will wait for a connection to be returned before throwing an exception, or -1 to wait indefinitely. --&gt;
              &lt;property name="removeAbandonedTimeout" value="2700" /&gt; &lt;!--removeAbandonedTimeout..Setting 15 minuts. Timeout in seconds before an abandoned connection can be removed. The value should be set to the longest running query your applications might have. --&gt;
              &lt;property name="logAbandoned" value="true" /&gt; &lt;!--logAbandoned.. Set to true to log stack traces for application code that abandons a Connection. Logging an abandoned Connection adds overhead for every Connection open because a stack trace has to be generated. --&gt;
              &lt;property name="defaultTransactionIsolation" value="1"/&gt;
      &lt;/bean&gt;
  </code></pre>