kundera
kundera copied to clipboard
Leak in Kundera 2.12 and Datastax Java Driver
I would to report that we have notice a memory leak when switched from Thrift to Datastax Java Driver that crashes our application (kundera 2.12).
Could you please share few more details? -Vivek
We have an application that makes massive inserts and reads from and to cassandra and we have identified a leak that makes our application turn down. Debugging the application, we have isolated the problem and realize that it is in the use of Kundera with DataStax Driver.
Can you please share the code snippet or sample app which leads to this leak ?
Chhavi
Hi guys! I faced with the same issue. This is details which can help to identify the problem
- Gradle dependency :
compile("com.impetus.kundera.client:kundera-cassandra-ds-driver:3.4")
- persistence.xml configuration :
...
<properties>
...
<property name="kundera.dialect" value="cassandra"/>
<property name="kundera.client.lookup.class"
value="com.impetus.kundera.client.cassandra.dsdriver.DSClientFactory" />
<property name="kundera.batch.size" value="5000" />
</properties>
...
- How I create EntityManager :
@PersistenceContext(
unitName = "cassandra",
type = PersistenceContextType.EXTENDED,
properties = {
@PersistenceProperty(name = "consistency.level", value = "QUORUM"),
@PersistenceProperty(name = CassandraConstants.CQL_VERSION,
value = CassandraConstants.CQL_VERSION_3_0)
}
)
protected EntityManager em;
- How I create entities via EntityManager:
for (File file : files) {
csvParser.beginParsing(file, StandardCharsets.ISO_8859_1);
String[] row;
while ((row = csvParser.parseNext()) != null) {
try {
Entity entity = new Entity();
...
em.save(entity);
} catch (Throwable e) { // NOSONAR
LOGGER.error("Error occured during parsing row :" + Arrays.toString(row), e);
}
}
csvParser.stopParsing();
}
I suppose that after auto flush operation, GC cannot remove flushed entities. As workaround I can call clear method explicitly for EntityManager but then no sense of using auto flush operation.
Maybe I do something wrong? If it's bug, maybe there is workaround for this problem?