JadiraOrg / jadira

Jadira Framework
Apache License 2.0
74 stars 44 forks source link

ConfigurationHelper leaks memory when SessionFactory is closed. #26

Closed kidnme closed 9 years ago

kidnme commented 10 years ago

When the session factory is closed, the integrator calls the ConfigurationHelper configureDefaultProperties() with a null set of properties. This causes the session factory to be removed from the DEFAULT_PROPERTIES hash, but not from the JDBC 42 hash. Repeated invocations of the Configuration Helper (as in unit tests that recreate the database and the session factory) will continue to add new session factories to the JDBC 42 hash - thus running large unit test suites out of memory.

YolandaMDavis commented 9 years ago

Experienced the same problem running with version 3.2.0 GA. In the context of Spring Batch we refer to several databases all whose session factory gets hashed in the ConfigurationHelper. After multiple executions of the batch process we experienced OutOfMemoryExceptions due to exceeding heap space. Using VisualVM we saw the same problem described by @kidnme where references to session factories were still in memory via the ConfigurationHelper JDBC42 hash. Our solution was to rollback to version 3.1.0 CR10 until this is resolved.

chrisphe commented 9 years ago

Will be resolved shortly in HEAD