RE: [Zope] Custom 404 - Resource not found

2006-04-20 Thread Andy Yates
  ...
 Changing standard_error_message does not seem change this error page.
 
 Maybe, you made a mistake?

Yes, I made a mistake!  In standard_error_message:

dtml-if error_message
 dtml-var error_message
dtml-else

  h2My TEST  Site Error/h2
...

404 errors hit the dtml-if and other errors, like attribute errors, go
to the dtml-else.   I was just modifying the else.

Thanks!
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Custom 404 - Resource not found

2006-04-18 Thread Andy Yates
Is there a way to customize the Zope 404 error page? 

Site Error
An error was encountered while publishing this resource.
Resource not found

Changing standard_error_message does not seem change this error page.  I
need to do this inside Zope or via the apache front end which talks to
Zope through mod_rewrite/proxy and Virtual Host Monster.


Thanks!
Andy
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


RE: No memory leak! (was: Re: [Zope] Memory Leak in Session Data Container)

2006-04-17 Thread Andy Yates
Leak, bug, improper configuration, what ever.  ;-)

With the onDelete in place for 1 week now I checked the temporary Cache
Parameters as you requested.  Since I put the onDelete on this server
memory use has still grown, but at a much slower rate.  I think it will
go about 10 days like this instead of 1 before using up all system
memory.

For whatever reason we have 7 caches on this server.  I do not see where
this is configured.
 
/Control_Panel/Database/temporary/manage_cacheParameters
Total number of objects in the database   363761
Total number of objects in memory from all caches34952
Target number of objects in memory per cache5000

I flushed the cache and about 1 hour after flushing, memory use has not
gone down at all.  During that hour objects in all caches went from 0 to
15341.  Objects in the transient object container are still holding
steady at 2000-3000.  Before the onDelete they grew without bound.

/Control_Panel/Database/temporary/manage_cacheParameters
Total number of objects in the database369885
Total number of objects in memory from all caches15341
Target number of objects in memory per cache5000

It seems odd to me that the total objects in the db are growing so
large.

If I understand you correctly a workaround would be to change the number
of objects per cache from 5000 to something more reasonable.  Where is
this configured and what is reasonable?  5, 50, 500.  I do not see an
item for this in the config file.  

Should there be any cache at all on an in-memory temp db?


Andy Yates


 -Original Message-
 From: Dieter Maurer [mailto:[EMAIL PROTECTED]
 Sent: Friday, April 14, 2006 7:54 AM
 To: Andy Yates; zope@zope.org
 Subject: No memory leak! (was: Re: [Zope] Memory Leak in Session Data
Container)
 
 Dieter Maurer wrote at 2006-4-11 22:14 +0200:
 Andy Yates wrote at 2006-4-10 12:43 -0500:
  ...
 Fortunately, I have an easy way to reproduce the problem and even
better
 I've found a work around.  My hope is that the work around will lead
 somebody more familiar with the innards of Zope to where the problem
is
 located.
 
 Congratulations!
 
 I will look into this within the next days (in Zope 2.8.1, however).
 
 I checked this:
 
There is no memory leak related to session handling in Zope 2.8.1!
 
  ...
 The ZODB cache may keep your session objects (and thereby its
 content) alive.
 
 Almost surely, this is what happened in Andy's test.
 
 
 Here is a description how I checked for the existence of a memory
 leak:
 
   I instrumented the pickles in
tempstorage.TemporaryStorage.TemporaryStorage
   such that I can find out the number of pickles stored
   (similar to the reference counts in Control_Panel/DebugInfo).
 
   I performed a mass test, creating thousands of sessions
   (similar to Andy's test).
 
   The pickle number stored by TemporaryStorage grew as expected
   (as it stores the sessions).
 
   I forced all session objects maintained by
/temp_folder/session_data
   to be discarded.
 
   Creating a single new session caused almost all TemporaryStorage
   pickles to be released.
 
   However, the ZODB caches still contained about 20.000 session
   objects. It was very surprising (and contrary to my previous
   message) that the storage flushed most of its pickles
   while references to them were still in the ZODB caches.
   This looks like a bug (but not a memory leak).
 
   I flushed the ZODB caches.
 
   I repeated the test and verified that the number of
   pickles remaining in TemporaryStorage does not increase.
 
 
 Results:
 
   * no memory leak!
 
   * maybe something that looks like a memory leak caused by the ZODB
caches
 which may hold up to 20.000 (with standard configuration) no
 longer used objects
 
 A more senseful configuration can work around this.
 
 
 --
 Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Memory Leak in Session Data Container

2006-04-10 Thread Andy Yates
Good day everyone!  I hope your weekend was as good as mine.  I didn't
have to work and I got to watch my son's first soccer (football) game!

For the past couple of years (I think) the Session Data Container has
been leaking memory.  During this time several leaks have been patch but
at least for our servers these fixes have only slowed down the process.
As our use of Zope grows and traffic to our site increases so does the
memory usage of Zope.  Unless Zope is restarted it will eventually use
all physical memory and swap space and crash the server.  Over the past
month the problem has once again grown to the point where we must
restarted Zope daily, sometimes even every 8 hours.

I don't know why this problem does not seem more wide spread.  My guess
is because our site has a large load and we make extensive use of
session variables. 

Fortunately, I have an easy way to reproduce the problem and even better
I've found a work around.  My hope is that the work around will lead
somebody more familiar with the innards of Zope to where the problem is
located.

TEST CASE

To reproduce the problem I used the following:
VA Linux Server w/ 1Gig
Fedora Core 3
Zope 2.7.8-final, python 2.3.4, linux2
Python 2.3.4 (#1, Feb 2 2005, 12:11:53) [GCC 3.4.2 20041017 (Red Hat
3.4.2-6.fc3)]
top and/or snmp to watch memory usage

Step 1:
In Zope I created the following script:

session = context.REQUEST.SESSION
s= 'Andy' * 102400;
session['sessiontest1']=s

The size of 's' depends purely on how fast you would like Zope to eat
memory.  On my server this will consume all physical memory in about
1000 calls.

Step 2:
Changed the session_data object timeout to 1 minute.  This is just to
cause the session objects to expire in 1 minute to hurry the test along.
Changed the Max subobjects to 0 (unlimited).  I don't know if this is
needed, but it is how we have our production servers set.

Step 3:
Use ab (apache bench) to call the script 1000 times using 10 concurrent
threads.
This causes Zope to consume over 90% of the memory as one would expect.
The transient object container (/temp_folder/session_data) will now show
1009 objects.  I don't know where the 6-9 extra come from.?

Step 4:
Wait 1-2 minutes for the objects to expire.
Note: Use a browser or ab to access some other resource in Zope and or
the script a number of times.  This is needed to tickle the transient
object container's expiration/garbage collection system.  (You've got to
keep those buckets moving)
As expected the transient object container now shows 0 objects.
However, Zope never releases the memory.  You can wait minutes, hours,
days what ever all the while tickling Zope.  Zope will NEVER release the
memory until it is restarted.  Oh, and new requests just use more
memory.  Zope is NOT just hanging on to it for future use.


THE WORK ARROUND

I created a script called onDelete
Parameter List sdo, toc
sdo.clear()


Then in /temp_folder/session_data I set the Script to call when objects
are deleted to /onDelete

Now when the tests are run the same amount of memory is consumed, but it
is released back to the system when the session objects expire.

CONCLUSION

To me it looks like data placed in the session object are not getting
deleted when the session object expires.  Anything placed in a session
object is essentially leaked.  When the onDelete script explicitly
removes the contents of the session data object the memory leak stops.


Comment?  Questions?  Fixes? ;-)

Thanks!
Andy Yates

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


RE: [Zope] zope vs. memory [was Re: Refcounts, ZODB Cache and memory leaks?]

2005-05-30 Thread Andy Yates
 
 Some moths ago, I found such a leak in the TempStorage
 implementation. However, this is fixed in recent Zope versions
 (I think since 2.7.5).

When you fixed the TempStorage the leak indeed slowed down
significantly.  However, Zope still leaks memory.  If left uncheck Zope
will still consume all available memory and crash the server.  We have
resigned ourselves to restarting Zope every few weeks.  

Andy

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


RE: [Zope] Dynamic Zope Style Sheets with HTML 4.01 Strict

2005-04-03 Thread Andy Yates
 I do exactly the same thing, except that I do it directly in the ZPT :
 span tal:omit-tag= tal:define=setcontentype
 python:here.REQUEST.RESPONSE.setHeader('content-type', 'text/css')/
 
 Pascal


AH, an elegant solution!  Thanks!!

 
 -Message d'origine-
 De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] la part de
 Andy Yates
 Envoyé : jeudi 31 mars 2005 21:53
 À : zope@zope.org
 Objet : RE: [Zope] Dynamic Zope Style Sheets with HTML 4.01 Strict
 
 
 Thanks!  I've never used dtml for style sheets.  I've always used page
 templates and never had a problem 'til now.  Also, I don't see a way to
 set the content type on a dtml doc or method.  I assume it would be
 text/html and then I back in the same boat.  To restate my problem,
 FireFox in HTML 4.01 Strict mode does not seem to accept a style sheet
 if the content type is text/html.  It needs to see text/css.  (Of course
 IE is fat dumb and happy)  Everything worked fine until I added this doc
 string to my page:
 
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN
 http://www.w3.org/TR/html4/strict.dtd;
 
 
 Unless somebody has some better magic this seems work.
 
 context.REQUEST.RESPONSE.setHeader('content-type', 'text/css')
 return context.stylesheet()
 
 This way I can leave the content type on the page template text/html so
 Zope is happy and make FireFox happy by overriding the content type to
 text/css.
 
 
 Andy
 
 
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
 Of Paul Winkler
  Sent: Thursday, March 31, 2005 12:00 PM
  To: zope@zope.org
  Subject: Re: [Zope] Dynamic Zope Style Sheets with HTML 4.01 Strict
 
  On Thu, Mar 31, 2005 at 11:38:59AM -0600, Andy Yates wrote:
   Am I going to have to write a python script to call the style sheet
 page
   template and change the content type or is there a better way to
 handle
   this?
 
  Page Templates are awkward to use for non-XML output. I never tried
  to use them for stylesheets.
  fwiw, I have good results using DTML Methods for my dynamic
 stylesheets.
  It's about the only thing I use DTML for anymore.
  Mine look roughly like this:
 
  dtml-with SomethingThatGivesMeABunchOfProperties
 
  body {
  background-color: dtml-mainBackgroundColor;;
  color: dtml-mainTextColor;;
  }
 
  /* more style rules follow */
  ...
 
  /dtml-with
 
  --
 
  Paul Winkler
  http://www.slinkp.com
  ___
  Zope maillist  -  Zope@zope.org
  http://mail.zope.org/mailman/listinfo/zope
  **   No cross posts or HTML encoding!  **
  (Related lists -
   http://mail.zope.org/mailman/listinfo/zope-announce
   http://mail.zope.org/mailman/listinfo/zope-dev )
 ___
 Zope maillist  -  Zope@zope.org
 http://mail.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists -
  http://mail.zope.org/mailman/listinfo/zope-announce
  http://mail.zope.org/mailman/listinfo/zope-dev )
 
 
 **
 This email and any files transmitted with it are confidential and
 intended solely for the use of the individual or entity to whom they
 are addressed. If you have received this email in error please notify
 the system manager.
 
 This footnote also confirms that this email message has been swept by
 MIMEsweeper for the presence of computer viruses.
 
 www.mimesweeper.com
 **

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Dynamic Zope Style Sheets with HTML 4.01 Strict

2005-03-31 Thread Andy Yates
Good day everyone!

I added a doc type string to one of my Zope pages because it needed to
pass an HTML 4.01 Strict validator.  When I did this FireFox seems to
ignore the style sheet.  My style sheet is dynamic so I used a page
template and tal.  If the Content Type on the style sheet is set to
text/html FireFox will not load the style sheet.  If I set the Content
Type to text/css I get an error when I save the page.

Compilation failed
xml.parsers.expat.ExpatError: syntax error: line 3, column 0

If I make my style sheet with a file and content type of text/cc instead
of a page template FireFox loads the style sheet but the tal statements
do not get rendered.

So, how do I make a dynamic style sheet that has the correct (text/css)
content type?

Am I going to have to write a python script to call the style sheet page
template and change the content type or is there a better way to handle
this?

Thanks!
Andy
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


RE: [Zope] Dynamic Zope Style Sheets with HTML 4.01 Strict

2005-03-31 Thread Andy Yates
Thanks!  I've never used dtml for style sheets.  I've always used page
templates and never had a problem 'til now.  Also, I don't see a way to
set the content type on a dtml doc or method.  I assume it would be
text/html and then I back in the same boat.  To restate my problem,
FireFox in HTML 4.01 Strict mode does not seem to accept a style sheet
if the content type is text/html.  It needs to see text/css.  (Of course
IE is fat dumb and happy)  Everything worked fine until I added this doc
string to my page:

!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN
http://www.w3.org/TR/html4/strict.dtd;


Unless somebody has some better magic this seems work.

context.REQUEST.RESPONSE.setHeader('content-type', 'text/css')
return context.stylesheet()

This way I can leave the content type on the page template text/html so
Zope is happy and make FireFox happy by overriding the content type to
text/css.


Andy
 

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Paul Winkler
 Sent: Thursday, March 31, 2005 12:00 PM
 To: zope@zope.org
 Subject: Re: [Zope] Dynamic Zope Style Sheets with HTML 4.01 Strict
 
 On Thu, Mar 31, 2005 at 11:38:59AM -0600, Andy Yates wrote:
  Am I going to have to write a python script to call the style sheet
page
  template and change the content type or is there a better way to
handle
  this?
 
 Page Templates are awkward to use for non-XML output. I never tried
 to use them for stylesheets.
 fwiw, I have good results using DTML Methods for my dynamic
stylesheets.
 It's about the only thing I use DTML for anymore.
 Mine look roughly like this:
 
 dtml-with SomethingThatGivesMeABunchOfProperties
 
 body {
   background-color: dtml-mainBackgroundColor;;
   color: dtml-mainTextColor;;
 }
 
 /* more style rules follow */
 ...
 
 /dtml-with
 
 --
 
 Paul Winkler
 http://www.slinkp.com
 ___
 Zope maillist  -  Zope@zope.org
 http://mail.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists -
  http://mail.zope.org/mailman/listinfo/zope-announce
  http://mail.zope.org/mailman/listinfo/zope-dev )
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )