Skip to content

Webapp classloader leaks problem with RiakNode.Builder or RiakClient [JIRA: CLIENTS-962] #660

@monday0rsunday

Description

@monday0rsunday

I'm using Riak java client (2.0.4) for our jax-rs services and I've encountered permgen OOM leak when reloading services.

I've created an example, just using this Listener (and uncomment cluster/client code) for any webapps, and seeing permgen space increase when reloading services (at least 2 times).

public class ContextListener implements ServletContextListener {
    public static RiakCluster cluster = null;
    public static RiakClient client = null;

    @Override
    public void contextInitialized(ServletContextEvent sce) {
        try {
            // RiakNode.Builder have perm gen leak when initialize any instance
            RiakNode.Builder builder = null;
            // builder = new RiakNode.Builder();

            List<String> addresses = new LinkedList<String>();
            addresses.addAll(Arrays.asList("anyip:port".split(",")));
            // or memleak when call buildNodes also
            List<RiakNode> nodes = null;
            // nodes = RiakNode.Builder.buildNodes(builder, addresses);
            // cluster = new RiakCluster.Builder(nodes).build();
            // cluster.start();

            // client = RiakClient.newClient();
        } catch (Exception e) {

        }
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        if (cluster != null)
            cluster.shutdown();
        if (client !=null)
            client.shutdown();
    }

}

Thanks,
Cong Nguyen

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions