Re: [xml] register i/o callback functionality

From: Mike Hommey

While talking about libxml in apache environment, I was wondering
recently what may happen when several apache modules, using libxml2,
call the InitParser and CleanupParser functions. When there is only one
module, thus one call, that's fine, but what happens when there are two ?
A typical case would be : the user changes the configuration of apache
to disable the php module, then reloads apache configuration. That
doesn't kill apache, but that unloads php, thus calling the domxml
unload function, thus calling CleanupParser. Now, what happens in an
other module using libxml2 after that ?
And I guess the Init/CleanupParser is not the only case of such
potential conflicts...

Note that I am no apache expert, so just summing up some of the things I
have seen while working with libxml under apache.

Those calls are safe to call multiple times. One reason PHP 5 uses 2.5.10 as
its minimum version is that at least in 2.5.8, there was a problem calling
CleanupParser multiple times. When the xml extensions were being developed
each one was calling the init/cleanup, which is where the issue in 2.5.8 was
hit (though has since been changed to a single library call so that its
called only once). I assume that on a reload, any module would be resetting
its state in any case, so they would be expecting the parser to be getting
initialized (which they would either do explicitly or libxml will do it when

From what was found, pretty much no other intitalization of libxml should be
done in the module initialization. For example, the generic error handling
functionality had to be isolated by moving it into the request startup
rather than module startup as it was bleeding into other modules and causing
them problems - like crashing apache :). Since then, other than the recent
i/o callback issue, there havent been any reported problems with other


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]