You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Alfredas Chmieliauskas <al...@sseriga.edu.lv> on 2002/06/28 22:49:36 UTC

IMPORTANT: Major Bug in XMLDBSource

  Hi all,

this bug relates to every cocoon and xindice versions available, thus it 
definately concerns you, if you're using xmldb and accessing it through 
XMLDBSource (xmldb: pseudo-protocol).

Short history:
We're developing a project that is based on cocoon + xindice and, for a 
while, we were wonering why using cocoon and xindice causes such high 
memory consumption, which on higher loads terminates xindice with an 
OutOfMemoryError. Moreover, similar problems have been reported to both 
lists some time ago.

No doubt about cocoon, I was blaming xindice for the error (that corba 
implementation seemed suspicious from the very begining). However, after 
some memory profiling done for both cocoon and xindice, I got myself to 
check out and revise the XMLDBSource source-code, which turned out to be 
the cause of the problem in the end.

The error is as follows:
Every new request to the database creates new XMLDBSource, which in turn 
registers a database implementation (driver) 
(DatabaseManager.registerDatabase(...)) *every time* it is created.

Thus after 15 requests to your databse you have 15 database client 
implemetations loaded by your VM.
You can guess what happens when you have 150 requests, can't you? ;-)

Quick-fix:
A reasonable and quick fix for the problem would be to move the 
connect() method from the XMLDBSource to the XMLDBSourceFactory.
Why, on earth, would one bother about the connection in the source 
methods, when it is the major concern for the SourceFactory, i wonder?

Proposal:
It seems that commonly the rdbms drivers are loaded through the 
cocoon.xconf or web.xml on servlet startup (hsqldb, for example?). Why 
not treat the xmldb drivers the same way?

I hope I saved some time (and memory ;-) for some of you,

Alfredas


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: IMPORTANT: Major Bug in XMLDBSource

Posted by Alex McLintock <al...@OWAL.co.uk>.
At 21:49 28/06/02, Alfredas Chmieliauskas wrote:
>  > this bug relates to every cocoon and xindice versions available, thus 
> it definately
> > concerns you, if you're using xmldb and accessing it through XMLDBSource
 > (xmldb: pseudo-protocol).

[memory leak description removed]


Thanks very much for spotting that. It seems to coincide with my 
experiences of running out of memory when making lots of Cocoon->XIndice calls.

I am about to go on holiday but if you can't find anyone to fix this in the 
next couple of weeks please email me and I will see what I can do. What you 
seem to be proposing is a Connection Pool for XMLDB in the same way as we 
have connection pools for database connections. That can't be too hard can 
it?    :-)

Alex McLintock




Openweb Analysts Ltd, London: Software For Complex Websites 
http://www.OWAL.co.uk/
Free Consultancy for London Companies thinking of Open Source Software.


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: IMPORTANT: Major Bug in XMLDBSource

Posted by Stephan Michels <st...@apache.org>.
On Fri, 28 Jun 2002, Alfredas Chmieliauskas wrote:

>   Hi all,
>
> this bug relates to every cocoon and xindice versions available, thus it
> definately concerns you, if you're using xmldb and accessing it through
> XMLDBSource (xmldb: pseudo-protocol).
>
> Short history:
> We're developing a project that is based on cocoon + xindice and, for a
> while, we were wonering why using cocoon and xindice causes such high
> memory consumption, which on higher loads terminates xindice with an
> OutOfMemoryError. Moreover, similar problems have been reported to both
> lists some time ago.
>
> No doubt about cocoon, I was blaming xindice for the error (that corba
> implementation seemed suspicious from the very begining). However, after
> some memory profiling done for both cocoon and xindice, I got myself to
> check out and revise the XMLDBSource source-code, which turned out to be
> the cause of the problem in the end.
>
> The error is as follows:
> Every new request to the database creates new XMLDBSource, which in turn
> registers a database implementation (driver)
> (DatabaseManager.registerDatabase(...)) *every time* it is created.
>
> Thus after 15 requests to your databse you have 15 database client
> implemetations loaded by your VM.
> You can guess what happens when you have 150 requests, can't you? ;-)
>
> Quick-fix:
> A reasonable and quick fix for the problem would be to move the
> connect() method from the XMLDBSource to the XMLDBSourceFactory.
> Why, on earth, would one bother about the connection in the source
> methods, when it is the major concern for the SourceFactory, i wonder?
>
> Proposal:
> It seems that commonly the rdbms drivers are loaded through the
> cocoon.xconf or web.xml on servlet startup (hsqldb, for example?). Why
> not treat the xmldb drivers the same way?
>
> I hope I saved some time (and memory ;-) for some of you,
>
> Alfredas

Thanks for your comment. I have tried to refactoring the
XMLDBSourceFactory. The new version in the scratchpad.

Can please test it?!

_______________________________________________________________________
         Stephan Michels               EMail: stephan@apache.org
         ICQ: 115535699                Tel: +49-030-314-21583
----+----|----+----|----+----|----+----|----+----|----+----|----+----|-|


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org