Skip to content

Close cluster after testing - #380

Merged
chbatey merged 1 commit into
akka:masterfrom
jiminhsieh:close-cluster
Aug 17, 2018
Merged

chbatey merged 1 commit into
akka:masterfrom
jiminhsieh:close-cluster

Conversation

@jiminhsieh

Copy link
Copy Markdown
Contributor

The cluster doesn't close after finishing the testing.
screen shot 2018-08-14 at 21 22 21
screen shot 2018-08-14 at 21 20 15

@chbatey

chbatey commented Aug 15, 2018

Copy link
Copy Markdown
Contributor

"cluster" here is a thread pool used by the cassandra driver. We try to name them all but we must miss one in the tests as "cluster" is the default name of of the threads if you don't explicitly set one.

@chbatey

chbatey commented Aug 15, 2018

Copy link
Copy Markdown
Contributor

We should name it here:

final override lazy val cluster = Cluster.builder()

Ideally we'd close it in only if the cluster has been used: https://github.com/akka/akka-persistence-cassandra/blob/master/core/src/test/scala/akka/persistence/cassandra/CassandraSpec.scala otherwise any test that hits that lazy val will need to do this.

However if you've verified this is the one that is leaked happy to merge this for now

@jiminhsieh jiminhsieh changed the title Close cluster after testing [WIP] Close cluster after testing Aug 15, 2018
@jiminhsieh

Copy link
Copy Markdown
Contributor Author

Thanks for the detailed explanation. :)

I verified again. EventsByTagRestartSpec is the class that didn't close the driver.

I can change to:

session.getCluster.close()

I did notice

lazy val session = {
cluster.connect(journalName)
}

, so I just close the cluster directly.

cluster.close()

We try to name them all

I am thinking of this:

  final override lazy val cluster = Cluster.builder()
    .addContactPoint("localhost")
    .withClusterName(this.getClass.getSimpleName)
    .withPort(port())
    .build()

@jiminhsieh jiminhsieh changed the title [WIP] Close cluster after testing Close cluster after testing Aug 16, 2018

@chbatey chbatey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, let's remove the leak and fix it in CassandraSpec alter

@chbatey
chbatey merged commit ab05aa0 into akka:master Aug 17, 2018
@jiminhsieh
jiminhsieh deleted the close-cluster branch September 4, 2018 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants