You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by Arthur Naseef <ar...@amlinv.com> on 2019/01/31 00:41:49 UTC

Artemis LibaioContext.c potential memory leak?

Looking at the following file to understand the functionality of the
library, I have a question around the allocation and freeing of iocb's:

activemq-artemis/artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c


Function
Java_org_apache_activemq_artemis_jlibaio_LibaioContext_deleteContext() does
not free iocb on failed call to submit(), and as far as I can tell,
submit() also does not free the structure on failure.

Did I miss something?

Art

Re: Artemis LibaioContext.c potential memory leak?

Posted by Otavio Piske <op...@redhat.com>.
I also think the code should destroy the mutex (by calling
pthread_mutext_destroy) as part of the cleanup on failure, but I did not
include it on PR #2530.

On Thu, Jan 31, 2019 at 5:54 AM Clebert Suconic <cl...@gmail.com>
wrote:

> That is correct.  The JVM will die upon critical failures.
>
>
> We should address it.  But it makes it a minor issue.
>
>
> It may be a bigger issue if the library is used outside of the context of
> artemis. But as it’s currently used it’s a minor issue.  We should address
> it.
>
> On Wed, Jan 30, 2019 at 7:53 PM Francesco Nigro <ni...@gmail.com>
> wrote:
>
> > I think that Otavio P on a recent PR has raised a similar question.
> > I think that's correct: we need to address a couple of changes to fix
> > cleanup on failures. The reason why they haven't been addressed is that a
> > critical I/O error could mean just JVM shutdown so the process's death
> > would release any native resources (hopefully is duty of the OS).
> > That's my guess.
> >
> > Franz
> >
> > Il giorno gio 31 gen 2019, 01:42 Arthur Naseef <ar...@amlinv.com> ha
> > scritto:
> >
> > > Looking at the following file to understand the functionality of the
> > > library, I have a question around the allocation and freeing of iocb's:
> > >
> > >
> > >
> >
> activemq-artemis/artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c
> > >
> > >
> > > Function
> > > Java_org_apache_activemq_artemis_jlibaio_LibaioContext_deleteContext()
> > does
> > > not free iocb on failed call to submit(), and as far as I can tell,
> > > submit() also does not free the structure on failure.
> > >
> > > Did I miss something?
> > >
> > > Art
> > >
> >
> --
> Clebert Suconic
>


-- 
Otavio R. Piske
Messaging Quality Assurance Engineer

Re: Artemis LibaioContext.c potential memory leak?

Posted by Clebert Suconic <cl...@gmail.com>.
That is correct.  The JVM will die upon critical failures.


We should address it.  But it makes it a minor issue.


It may be a bigger issue if the library is used outside of the context of
artemis. But as it’s currently used it’s a minor issue.  We should address
it.

On Wed, Jan 30, 2019 at 7:53 PM Francesco Nigro <ni...@gmail.com> wrote:

> I think that Otavio P on a recent PR has raised a similar question.
> I think that's correct: we need to address a couple of changes to fix
> cleanup on failures. The reason why they haven't been addressed is that a
> critical I/O error could mean just JVM shutdown so the process's death
> would release any native resources (hopefully is duty of the OS).
> That's my guess.
>
> Franz
>
> Il giorno gio 31 gen 2019, 01:42 Arthur Naseef <ar...@amlinv.com> ha
> scritto:
>
> > Looking at the following file to understand the functionality of the
> > library, I have a question around the allocation and freeing of iocb's:
> >
> >
> >
> activemq-artemis/artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c
> >
> >
> > Function
> > Java_org_apache_activemq_artemis_jlibaio_LibaioContext_deleteContext()
> does
> > not free iocb on failed call to submit(), and as far as I can tell,
> > submit() also does not free the structure on failure.
> >
> > Did I miss something?
> >
> > Art
> >
>
-- 
Clebert Suconic

Re: Artemis LibaioContext.c potential memory leak?

Posted by Francesco Nigro <ni...@gmail.com>.
I think that Otavio P on a recent PR has raised a similar question.
I think that's correct: we need to address a couple of changes to fix
cleanup on failures. The reason why they haven't been addressed is that a
critical I/O error could mean just JVM shutdown so the process's death
would release any native resources (hopefully is duty of the OS).
That's my guess.

Franz

Il giorno gio 31 gen 2019, 01:42 Arthur Naseef <ar...@amlinv.com> ha scritto:

> Looking at the following file to understand the functionality of the
> library, I have a question around the allocation and freeing of iocb's:
>
>
> activemq-artemis/artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c
>
>
> Function
> Java_org_apache_activemq_artemis_jlibaio_LibaioContext_deleteContext() does
> not free iocb on failed call to submit(), and as far as I can tell,
> submit() also does not free the structure on failure.
>
> Did I miss something?
>
> Art
>