Skip to content

Conversation

@alexmoore
Copy link
Contributor

@alexmoore alexmoore commented Sep 28, 2016

Fixes #660 (CLIENTS-962), abstracts away the calls needed to cleanup Netty's thread local variables, so we don't leak classloaders into permgen memory upon container reload.

cc/ @monday0rsunday

.travis.yml Outdated
script:
- if [ $RIAK_FLAVOR == "riak-kv" ]; then mvn -Pitest,default -Dcom.basho.riak.yokozuna=false
verify; else echo "Not riak-kv flavor"; fi
verify; for i in {1..10}; do mvn -Ptest-debug-logging surefire:test -Dtest=RiakClusterTest; done; else echo "Not riak-kv flavor"; fi
Copy link
Contributor

Choose a reason for hiding this comment

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

😭 ugh

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, trying to track down a very slippery heisenbug.

RiakCluster cluster = new RiakCluster.Builder(builder.build()).build();
cluster.start();
return new RiakClient(cluster);

Copy link
Contributor

Choose a reason for hiding this comment

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

Here kid, have a newline.

* Call this method when your application is being unloaded from the container, <b>after</b>
* all {@link RiakNode}, {@link RiakCluster}, and {@link com.basho.riak.client.api.RiakClient}
* objects are in the shutdown state.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this just be part of shutdown?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nah, b/c:

  1. If "the user" instantiated 2 RiakCluster or RiakClient objects for some reason, it could clear all the Netty threadlocals if one is still running.
  2. It would turn shutdown() into a partially synchronous method, as we'd have to wait for the shutdown future to finish, then call cleanup.
  3. This is only for environments that swap out classloaders.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK

@lukebakken
Copy link
Contributor

:shipit: once you nuke that newline :-)

@alexmoore alexmoore merged commit f0c2815 into develop Sep 29, 2016
@alexmoore alexmoore deleted the 660-Classloader-permgen-leaks branch September 29, 2016 00:29
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.

4 participants