- 
                Notifications
    You must be signed in to change notification settings 
- Fork 38.8k
Description
Phil Webb opened SPR-11372 and commented
Spring Batch recently hit a very hard to track-down problem when upgrading from Spring 3.2.0 to 3.2.7.
When running the entire test suite some tests fail with the following exception:
java.sql.SQLNonTransientConnectionException: connection exception: closed
Running tests in isolation causes no problems.
The minimum suite that replicates the issue is:
@RunWith(Suite.class)
@SuiteClasses({
SimpleJobRepositoryIntegrationTests.class,
JobBuilderConfigurationTests.class,
ChunkOrientedStepIntegrationTests.class })
public class ReproTests {
}After a lot of digging it appears that the root cause of the failure is #14347 [1].
Here is what happens:
SimpleJobRepositoryIntegrationTests uses spring-test and includes a commons-dbcp data-source. The data-source is part of a config that is cached.
JobBuilderConfigurationTests creates a direct EmbeddedDataSource. Tests here do not use spring-test. When the context is closed the shutdown method is called on the EmbeddedDataSource. This in turn issues some SQL that actually closes the HSQLDB session.
ChunkOrientedStepIntegrationTests runs, and reuses the previously created commons-dbcp pool. The pool appears to be open but because the entire session has been shutdown interaction cause exceptions.
[1] 4c823a3
Affects: 3.2 GA, 4.0 GA
Issue Links:
- De-register JDBC drivers on EmbeddedDatabase shutdown [SPR-7978] #12633 De-register JDBC drivers on EmbeddedDatabase shutdown
- Introduce support for generating unique names for embedded databases [SPR-8849] #13491 Introduce support for generating unique names for embedded databases
1 votes, 7 watchers