I just had a quick look at dbi_main.c. From my understanding, there is
at least a memory leak when dbi_shutdown is called from the same
instance (if called from within the same instance). In that case, the
first dbi_initialize() driverlist is discarded (but not freed) by
rootdriver = NULL. Once dbi_shutdown is called, things may (or may not)
go wrong because of this freed memory (and the change in the driver list
- I have not yet checked when it is accessed).

The question is what the loader does. IMHO it depends on the platform. I
can envision when you have

a) rsyslog -> plugin_a ->dbi_initilize()
b) rsyslog -> plugin_b ->dbi_initilize()

There are instances where dbi is just loaded once into memory, with a
single static memory pool (in fact my *uneducated* guess is that that
would happen on most platforms. Then, we have the problem outlined above
and can get into all sorts of nice troubles. Of course, if each instance
receives its fresh dlloaded libdbi, everything should work really well.

In any case, I suggest that a second call of dbi_initialize() inside the
same instance should return an error state - sounds better than
unpredictable behavior. Making it multi-init safe could IMHO easily be
done by using one additional handle.

Just some thoughts...

Rainer
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:libdbi-users-
> [EMAIL PROTECTED] On Behalf Of Rainer Gerhards
> Sent: Friday, February 15, 2008 6:27 PM
> To: Markus Hoenicka; libdbi-users@lists.sourceforge.net
> Subject: Re: [libdbi-users] Feedback and Questions [resend]
> 
> > > Would rsyslog be suitable to run such a test, e.g. by
> > > loading the output plugin and another (maybe renamed) copy of the
> > same
> > > plugin? This is an interesting problem also for other projects
> which
> > > use a plugin system and libdbi.
> >
> > I can do that with rsyslog. Actually, I just need to remove an if()
> > that
> > guards multiple instances from my plugin to call libdbi init more
> than
> > once. I'll try to do that Monday. Let you know the results when I
> have
> > them. It will probably not a very in-depth test, but at least it can
> > provide some idea of how things happen to work.
> 
> OK, I did a quick test using what I proposed. That worked fine (aka
"no
> crashes and data inserted"). But, of course, it struck me that this
was
> different from your question. After all, it now was the same instance
> that called dbi_initialize() twice.
> 
> I'll now see that I create a copy of the plugin and rename it and then
> try it again. That won't fit today, I fear ;)
> 
> Rainer
> 
>
-----------------------------------------------------------------------
> --
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> libdbi-users mailing list
> libdbi-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libdbi-users

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
libdbi-users mailing list
libdbi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-users

Reply via email to