On Wednesday 05 April 2006 23:07, gabor wrote: > hi Jacob, many thanks for the explanation. > > (and sorry to jump into the discussion).. > > the original poster (luke plant) said that: > > " > It appears > that connections are not being closed at all. With every hit I'm > getting another entry in the process table > " > > so if he's only hit by the reuse-open-connection effect, it should be > pretty easy to reproduce: > > setup apache with maxclients = 3, and do more than 3 requests. > > if the number of open psql connections stays 3, everything is ok. > if it increases, there's a problem.
I have done some more testing with the original code. If I restrict MaxClients, the number of apache processes is limited to MaxClients + 1, so that seems to be working as it ought. However, the number of postgres processes never decreases, until I've done about 100 requests, when I get the error message originally seen, and from that point Django doesn't work at all. At this point "select count(*) from pg_stat_activity" shows 98, and in my postgresql.conf I've got max_connections=100, which is the default I believe (maybe it reserves a couple so you can go in and fix it). I've done most of these experiments on my dev box, which is running Ubuntu 5.10, Apache 2.0.54 with prefork. My production box is "Red Hat Enterprise Linux ES release 4 (Nahant Update 3)", running Apache/2.0.46, also with prefork (I think). I haven't done so much experimenting on the production box (for obvious reaons), but it appears that exactly the same thing is happening. Given these facts, I don't think it should be too hard for someone else to replicate this. One thing not resolved is why my changes make any difference anyway - why should attaching the signal to 'connection.close' be different from 'lambda: connection.close()' ? I presume it must be some reference that isn't being gc'd or the like. I haven't actually changed the *intent* of the code AFAICS, but it does have make difference on behaviour. I confess to not knowing much about this sort of thing, so someone with more knowledge please feel free to revert my changes. But at the moment, I don't think the original code is workable - unless you only ever have 100 requests between bouncing apache :-) Thanks, Luke -- "Despair: It's always darkest just before it goes pitch black." (despair.com) Luke Plant || L.Plant.98 (at) cantab.net || http://lukeplant.me.uk/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers -~----------~----~----~----~------~----~------~--~---