Skip to content

0.19 - Potential Leak in CompositeSubscription with Executor? #1312

@daschl

Description

@daschl

Hey folks,

doing performance tests with 0.19 did bring up something interesting - check this out on a 4gig heap:

screen shot 2014-06-04 at 09 34 22

96% of my heap are taken up by the CompositeSubscription.

I'm running a workload like this, that is fetching docs out of the server (but here for example without any docs, so they are not found - to not mess with object decoding in the benchmark.)

        List<GetRequest> keys = new ArrayList<GetRequest>(1024);
        for (int i = 0; i < 1024; i++) {
            keys.add(new GetRequest("key" + i, bucket));
        }

        while(true) {
            final CountDownLatch latch = new CountDownLatch(1);
            Observable.from(keys).flatMap(new Func1<GetRequest, Observable<?>>() {
                @Override
                public Observable<GetResponse> call(GetRequest s) {
                    return cluster.send(s);
                }
            }).toList().doOnCompleted(new Action0() {
                @Override
                public void call() {
                    latch.countDown();
                }
            }).subscribe();
            try {
                latch.await();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

Looking into the CompositeSubscription the dump makes sense since it uses a HashSet which is internally backed by a HashMap.

Another hint might be that they seem to be hanging around in the executor?
screen shot 2014-06-04 at 09 44 16

Not sure if there is a leak somewhere (I'm assuming, since 95% are reachable in the heap dump!), but it is causing unbearable pressure on the test system. In case you wonder about the workload, its around 100k ops/s until it goes nuts since GC takes up all time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions