RE: [Zope-DB] Closing idle DCoracle2 Connections?

2005-10-24 Thread Germer, Carsten
Ok, that's a bit much for my question I guess...
I gather from all your mails that I can not close a database
connection periodically or on event from Zope (Script or whatever)?
Any hands-down clues what I can do to prevent db-conns from ideling
around?
/Carsten

-Original Message-
From: Dieter Maurer [mailto:[EMAIL PROTECTED] 
Sent: Saturday, October 22, 2005 8:07 PM
To: Matthew T. Kromer
Cc: Chris Withers; Germer, Carsten; zope-db@zope.org
Subject: Re: [Zope-DB] Closing idle DCoracle2 Connections?


Matthew T. Kromer wrote at 2005-10-21 20:39 -0400:
 ...
What happens with Zope and DCOracle2 I think is when the DA  
connection object is ghosted, it doesn't know about it, and thus  
doesn't close its connection.

Why not?

  When the DA instance is ghosted, the db object is deleted
  (last reference released).

  In an optimal world, the deletion of the db object would release
  the last reference to the DCOracle connection and this
  would close the connection to Oracle before the memory
  is released.

 ...
The close is implicit when the  
connection object is destroyed, but usually there's so much stuff  
loaded that *someone* has a reference to the connection.

That's the bug.

There should be no references to DCOracle resources outside
the db object (at least, Zope's DA/ZSQL do not require
such references outside). Thus, when the db object goes away,
the DCOracle resources should, too.

However, the code is still geared around OCI8 and some Oracle 
9 code,  
its due for some refactoring in a big way to deal with the profusion  
of handle-driven objects now much more prevalent in Oracle 10.

-- 
Dieter

___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Closing idle DCoracle2 Connections?

2005-10-21 Thread Chris Withers

Cynthia Kiser wrote:

open. FYI just closing the database connection via the ZMI does not
release the idle connections Oracle still sees. 


Yes, that button actually does nothing ;-)

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Closing idle DCoracle2 Connections?

2005-10-21 Thread Chris Withers

Dieter Maurer wrote:

Usually, there is not need for a sophisticated connection
management. Just do not create unnecessary DA instances.


Yes, this is the most common mistake...


Bugs should be fixed and not worked around with more complex
software (complex connection management).


Well, it depends, there can be a need for lots of infrequently used DA's 
connecting to the same database. Having these be able to share 
connections can be useful.



I know that I wouldn't want the connection being closed from Oracles
side as I have read in the mailinglist that DCOracle would still think
the connection is open and generate an error.


The DA catches OperationalErrors and reopens the connection.
It tries to do this transparently (though a bit wrong).


Well, it doesn't succeed for Not Connected and several other salient 
Oracle errors.


FWIW, if people can, I'd recommend moving to cxOracle. There's more life 
there now :-(


Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Closing idle DCoracle2 Connections?

2005-10-20 Thread Dieter Maurer
Germer, Carsten wrote at 2005-10-20 11:16 +0200:
 ...
As we start to use our zope-Ora connection more frequently our database
administrator complains that he sees a lot of idle conections.

I know theres connection.close() in DCOra2 but does anyone know of a
way to autmatically close a DCOra within Zope when idle soandso long? Or
any other way to adress such a problem?

Modulo bugs, the connection will be closed when
the DA object is flushed from the ZODB cache.

The ZODB cache is controlled by a maximal size (number of objects)
and replaces objects with a least recently used policy.

Usually, there is not need for a sophisticated connection
management. Just do not create unnecessary DA instances.
Modulo bugs, the total number of needed connections
is number of DA objects times the number of worker threads.

If you see more open connections than this value, you see a bug.


Bugs should be fixed and not worked around with more complex
software (complex connection management).

I know that I wouldn't want the connection being closed from Oracles
side as I have read in the mailinglist that DCOracle would still think
the connection is open and generate an error.

The DA catches OperationalErrors and reopens the connection.
It tries to do this transparently (though a bit wrong).

-- 
Dieter
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db