Re: [ZODB-Dev] Query Regrading ZODB FileStorage(.fs file)

2005-12-31 Thread Dieter Maurer
Please always stay on the list!

Monica chopra wrote at 2005-12-30 19:22 -0800:
 ...
  Thanks for responding but can clarify more about how to do that. How can i 
 make an ecrypted file.
 ...
Dieter Maurer [EMAIL PROTECTED] wrote:
  Monica chopra wrote at 2005-12-29 18:17 -0800:
...
It would not be difficult to implement an EncryptedFileStorage.

A file storage is a sequence of transaction logs.
Currently, it writes the transaction log in clear text.
An EncryptedFileStorage would instead write and (later) read
(partially) encrypted log entries. For the details, you
would need to carefully look at how FileStorage works.

But, have you read (and appreciated) my objection?
I repeat:

  Why is it significantly easier to protect the key[s]
  used for the encryption than the storage itself?


If this is indeed the case for you, you might find the use
of an encrypted filesystem even more attractive: there
all your files (and not only part of the storage file) are
encrypted. Of course, key handling will remain an issue...


-- 
Dieter
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


RE: [ZODB-Dev] Re: Connection pool makes no sense

2005-12-31 Thread Dieter Maurer
Tim Peters wrote at 2005-12-30 14:51 -0500:
[Dieter Maurer]
 They did not tell us about their application. But, Zope's database
 adapters work like this. They use the ZODB cache (and its pool) as an RDB
 connection pool. Thus, if the ZODB caches are not released, the RDB
 connections won't.

I believe you, but I'm not sure what to make of it; for example,

1. The OP is the only person who has this problem?

2. Other people have this problem too, and don't know what to do about
   it either, but never complain?

I expect (but the original poster may step in) that the problem
could occur in Zope only when the number of threads exceeds
the pool size (or additional connections are used in an application
specific way) as otherwise, there are no dropped connections.

Because formerly, it made no sense to have more worker threads than
that given by the pool size, this situation is likely to occur
rarely.

 ...
 If not, you may have better luck on the zope-db list (which is
 devoted to using other databases with Zope):

 The problem is not with the RDB but with the ZODB connections that are
 magically not garbage collected. He will probably not find help on
 zope-db.

That suggestion was based on a guess that #3 (above) is most likely.  Of
course I don't know, but #1 and #2 seem unlikely on the face of it.  If
other people using RDB don't have this problem, then zope-db is the right
place to ask how they manage to avoid it.

If the poster has no evidence that the ZODB connections are definitely kept
but just see that the relational database connections remain open,
the reason might indeed be at a completely different place:

  There are some reports on zope-db about DAs leaking relational
  database connections.
  
  The problem is not related to ZODB connection handling.
  Instead, the relational database connection is kept open
  even if the DA object was invalidated (and especially cleared).


We observed such behaviour with Zope 2.7/ZODB 3.2 and ZPsycopgDA.

   When we used resetCaches (which should in principle release
   the old caches (I also added an minimizeCache because
   the cyclic gc does not work with Zope 2.7's ExtensionClass objects)),
   a new set of Postgres connections was opened without
   the old ones being closed.

   We worked around this problem by:

 *  avoiding to use resetCaches

 *  restarting Zope once a weak to get rid of
stale Postgres connections

 ...
OTOH, if that's not
what's going on here, I'd expect to have heard about this here more than
once in the last 5 years ;-)

The older ZODB code (ZODB 3.2 and before) was seriously flawed
with respect to cache release handling.

Fortunately, it was very rare that caches need to be released.

I found the flaws because we used temporary connections extensively
and, of course, their caches need to go away with the temporary
connection. I had a hard fight to get rid of the memory leaks
induced by those flaws.


Now (ZODB 3.4 and above) caches might get released more often.
True, the garbage collector now has a chance to collect cycles
including ExtensionClass objects, but it is very easy to
defeat the GC -- an object with a __del__ method is sufficient.

 Perhaps because the OP is unique in allowing
hundreds (or thousands -- whatever) of Connections to be active
simultaneously?  Don't know.

He did not say that.

  If his hypothesis is indeed true and some connections exceeding
  the pool size are kept indefinitely, then already slightly
  exceeding the pool size may lead to an unbound number of connections
  provided the exceedance occurs frequently enough.


I suggested before that forcing calls to gc.collect() would give more
evidence.  If that doesn't help, then it's most likely that the application
is keeping Connections alive.  Since I'm not familiar with the RDB code, I
suppose it's even possible that such code uses __del__ methods, and creates
cycles of its own, that prevent cyclic gc from reclaiming them.  In that
case, there are serious problems in that code.

There is also another gc attribute holding the garbage cycles
not released. The poster may examine them to check whether they
contain indeed ZODB connection objects.

-- 
Dieter
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


Re: [ZODB-Dev] Query Regrading ZODB FileStorage(.fs file)

2005-12-31 Thread Tino Wildenhain
tav schrieb:
  Why is it significantly easier to protect the key[s]
  used for the encryption than the storage itself?
 
 
 one could always passphrase-protect the key, i.e. use symmetric encryption.
 
 admittedly, this could potentially be brute-forced, but ... should be
 good enough for most purposes?
 
And how does your Application (Zope) access the storage?
Exactly. It needs the key - if it has the key - the attacker
can just read the data thru the application.

In the end this does not buy you anything but overhead.

If you want to encrypt, just use a crypted filesystem as
DM already suggested. Best performance, best transparency
and well tested.
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev