aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Thevenot (JIRA)" <>
Subject [jira] [Commented] (ARIES-1603) Aries async classloader leak
Date Wed, 07 Sep 2016 15:34:20 GMT


Paul Thevenot commented on ARIES-1603:

Sure! We use it to delegate some methods execution and periodic treatments asynchronously.
We have a service shared by all bundles doing async operations. 

final Runnable executor = async.mediate(target, Runnable.class);;
async.execute().recover(promise -> {
	try {
		LOGGER.warn("Failed to execute asynchronous method using OSGi Async service: {}", source,
	} catch (InterruptedException ignore) {
	return null;

That's true, we don't keep the mediated classes. Every time we need an async execution, we
call the mediate method. I just read the osgi r6 spec again and you're right, it does says
that the client may store them. Actually, our implementation does not allow us to store them.
I'll see if we could store them and if it's not a problem because it means store an object
for each asynchronous method. 

Anyway, I'm not sure that the fact that we store or not the mediated objects is directly the
cause of the issue. Actually, as a workaround, I've clone the repo and removed the new ClassLoader()
in the privmediate method. It's not leaking anymore. What is the purpose of the classloader
clone? The prevent an execution after a service shutdown?

We had the issue with a few amount of asynchronous tasks repeating all the time (our periodic

> Aries async classloader leak
> ----------------------------
>                 Key: ARIES-1603
>                 URL:
>             Project: Aries
>          Issue Type: Bug
>    Affects Versions: async-1.0.2
>            Reporter: Paul Thevenot
> Using the async service with repeated tasks during one hour leads to an out of memory.
It's due to the very large amount of class loaded (in 10 min we get 20000 classes loaded).
The metaspace is growing indefinitely.
> It seems to come from the privMediate method of the AsyncService where the classloader
of the target service is cloned.

This message was sent by Atlassian JIRA

View raw message