[
https://issues.apache.org/jira/browse/DERBY-6114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Knut Anders Hatlen updated DERBY-6114:
--------------------------------------
Attachment: derby-6114-1a-purge.diff
I'm currently running tests on the attached derby-6114-1a-purge.diff patch.
This patch makes the timer factory invoke purge() on the timer on every 1000th
cancellation. The number 1000 was picked arbitrarily. It didn't feel right to
do it every time a task was cancelled (as that's the path taken on normal
execution when a transaction timeout is in effect). 1000 sounded like a
reasonable trade-off. 1000 cancelled tasks won't take up very much memory, and
traversing the timer's queue once per 1000 successful transaction doesn't sound
like a very high cost.
A new implementation of TimerFactory is added, Java5SingletonTimerFactory,
which extends the existing SingletonTimerFactory. A new factory is not
necessary on trunk, since Java 6 is the base level, but it eases back-porting
to older branches where the purge() method is not available on the base level.
I plan to collapse Java5SingletonTimerFactory and SingletonTimerFactory on
trunk once the fix has been back-ported.
I do *not* plan to implement a specific fix for Java 1.4 and/or CDC on older
branches. They will still have the old behaviour. Note that "ant junit-lowmem"
only runs if the JVM is at least at level 1.5, so the test problems don't
affect the old platforms.
The patch changes the TimerFactory interface so that it doesn't return a
reference to the actual java.util.Timer instance. This makes it easier to hide
the logic inside the factory, rather than duplicating logic for purging tasks
at the callers.
The patch removes the comment in memory._Suite that says the test has to run as
the last test (DERBY-5394), as it is no longer the case that the test holds on
to a lot of garbage when it's done.
I ran XAMemTest with 12MB heap with and without the patch. The patch reduced
the time to complete the test from 15 minutes to 1 minute due to earlier
release of the task instances and lower GC overhead.
> OOME in XAMemTest.testDerby4137_TransactionTimeoutSpecifiedNotExceeded
> ----------------------------------------------------------------------
>
> Key: DERBY-6114
> URL: https://issues.apache.org/jira/browse/DERBY-6114
> Project: Derby
> Issue Type: Bug
> Components: Test
> Affects Versions: 10.9.2.2, 10.10.1.1
> Environment: Derby head of 10.10 branch. ubuntu3 slave on
> builds.apache.org. Java SE 7u4, 64-bit.
> java.vendor=Oracle Corporation
> java.runtime.version=1.7.0_04-b20
> os.name=Linux
> os.arch=amd64
> os.version=3.2.0-38-generic
> Reporter: Knut Anders Hatlen
> Assignee: Knut Anders Hatlen
> Priority: Minor
> Attachments: derby-6114-1a-purge.diff, derby.log, error-stacktrace.out
>
>
> Seen twice in a row in https://builds.apache.org/job/Derby-10.10-suites.All/ :
> junit-lowmem:
> [junit] Running org.apache.derbyTesting.functionTests.tests.memory._Suite
> [junit] Exception in thread "DRDAConnThread_11"
> java.lang.OutOfMemoryError: GC overhead limit exceeded
> [junit] at java.util.Properties$LineReader.<init>(Properties.java:405)
> [junit] at java.util.Properties.load(Properties.java:341)
> [junit] at
> java.util.PropertyResourceBundle.<init>(PropertyResourceBundle.java:130)
> [junit] at
> java.util.ResourceBundle$Control.newBundle(ResourceBundle.java:2610)
> [junit] at java.util.ResourceBundle.loadBundle(ResourceBundle.java:1436)
> [junit] at java.util.ResourceBundle.findBundle(ResourceBundle.java:1400)
> [junit] at java.util.ResourceBundle.findBundle(ResourceBundle.java:1354)
> [junit] at
> java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1296)
> [junit] at java.util.ResourceBundle.getBundle(ResourceBundle.java:796)
> [junit] at
> org.apache.derby.iapi.services.i18n.MessageService.getBundleWithEnDefault(MessageService.java:318)
> [junit] at
> org.apache.derby.iapi.services.i18n.MessageService.getBundleForLocale(MessageService.java:53)
> [junit] at
> org.apache.derby.iapi.services.i18n.MessageService.getBundle(MessageService.java:302)
> [junit] at
> org.apache.derby.iapi.services.i18n.MessageService.getCompleteMessage(MessageService.java:97)
> [junit] at
> org.apache.derby.iapi.error.SQLWarningFactory.newSQLWarning(SQLWarningFactory.java:97)
> [junit] at
> org.apache.derby.iapi.error.SQLWarningFactory.newSQLWarning(SQLWarningFactory.java:50)
> [junit] at
> org.apache.derby.iapi.jdbc.BrokeredConnection.statementHoldabilityCheck(BrokeredConnection.java:736)
> [junit] at
> org.apache.derby.iapi.jdbc.BrokeredConnection.prepareStatement(BrokeredConnection.java:690)
> [junit] at
> org.apache.derby.impl.drda.DRDAStatement.prepare(DRDAStatement.java:669)
> [junit] at
> org.apache.derby.impl.drda.DRDAStatement.explicitPrepare(DRDAStatement.java:630)
> [junit] at
> org.apache.derby.impl.drda.DRDAConnThread.parsePRPSQLSTT(DRDAConnThread.java:3912)
> [junit] at
> org.apache.derby.impl.drda.DRDAConnThread.processCommands(DRDAConnThread.java:811)
> [junit] at
> org.apache.derby.impl.drda.DRDAConnThread.run(DRDAConnThread.java:295)
> [junit] Tests run: 67, Failures: 0, Errors: 1, Time elapsed: 1,571.059 sec
> [junit] Test org.apache.derbyTesting.functionTests.tests.memory._Suite
> FAILED
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira