Description
StatementJdbc30Test.xtestMaxOpenStatementsWithQueryTimeout takes close to four minutes in my environment. It turns out it spends most of the time in tearDown() closing statements.
The test case opens a lot of statements (more than 16000) on the same connection and keeps them open until the test has completed, to verify that it is possible to have that many open statements on a single connection when a query timeout has been specified. The test case runs with auto-commit enabled, and every call to Statement.close() in tearDown() therefore results in an implicit commit. When committing a transaction, the engine needs to go through the list of activations in that transaction. Since there's one activation per open statement, that list is pretty long. Although it gets shorter for each statement that is closed, it takes a while to get through all the statements (~16000^2/2 activations need to be checked before all statements are closed...).
This can easily be fixed by disabling auto-commit for the test case. Since no (implicit) commit happens during the test case itself, this doesn't change the semantics of the test case. It will speed up the closing of the statements in tearDown() because it will no longer run 16000 implicit commits and traverse the long list of activations 16000 times.
Attachments
Attachments
Issue Links
- relates to
-
DERBY-3198 Using setQueryTimeout will leak sections
- Closed