[Zope-dev] SQLAlias Memory Leak?

Dyon Balding dyon@devcoder.com.au
Thu, 7 Dec 2000 06:50:35 +1100


OK, I've had more of a hack at this, and I've narrowed the problem
down a little.

It appears that any access to an SQLAlias object causes it to not
be correctly released.  The SQLAlias objects means that you can
access column names using a different case to how they are stored
in the database.

For example, we store users in a users table in the database, with
column names like USERNAME, but they are accessed with:
<dtml-var username>, this causes the SQLAlias objects to stick around.

One solution to our problem is to just do a <dtml-var USERNAME>
instead.  However that doesn't solve the problem with this
"feature" of being able to call it with a different case.

This is a fairly easy bug to reproduce, on my setup at least :).
I have tested it with ZSQLRelay and ZODBDA both talking to SQLServer,
and with ZPyGreSQLDA talking to PostgreSQL.

I would appreciate it if someone else can reproduce the bug,
and I'll put it in the Collector I guess.

thanks
-d

On Wed, Dec 06, 2000 at 09:06:47AM +1100, Dyon Balding wrote:
> Hi,
> 
> I have an application that stores state data in a
> SQLServer database.  The Zope and database servers
> run on different windows machines, using the ZODBCDA
> product to connect Zope to the ODBC machinery.
> 
> What I have been observing is that the Zope client's
> memory usage increases consistently when ZSQL methods
> are being called.  In the Debug screens, the
> culprit appears to be Shared.DC.ZRDB.RDB.SQLAlias.
> 
> Here's a dump of the first few lines after hitting
> a ZSQL method a few hundred times using ab.  The
> SQLAlias figures never seem to go down.
> 
> Class 
>                                                 December 5, 2000
>                                                 1:58 pm 
>                                                                      December 5, 2000
>                                                                      2:01 pm 
>                                                                                          Delta 
>         Shared.DC.ZRDB.RDB.SQLAlias 
>                                                 1048 
>                                                                      4068 
>                                                                                          +3020 
>         ZClasses.ZClass.ZClass 
>                                                 73 
>                                                                      108 
>                                                                                          +35 
>         OFS.DTMLMethod.DTMLMethod 
>                                                 63 
>                                                                      94 
>                                                                                          +31 
> 
> In fact most of our servers run out of memory and need
> to be restarted every couple of days when they get
> sufficient use.
> 
> I've done a bit of a search of the mailing lists, and noone
> else appears to be having the same problem.  So does
> anyone have an idea of what we might be doing differently
> to everyone else?  We appear to have the latest versions
> installed.
> 
> I've had a bit of a look through the code, and it appears
> that SQLAlias is used to case desensitize the column names
> of the returned data?
> 
> Any pointers would be appreciated.
> 
> thanks, d
> 
> -- 
> |    Dyon Balding             dyon@devcoder.com.au |
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )

-- 
Dyon Balding <dyon@devcoder.com.au>