[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#548024: packages.debian.org: mirror doesn't close old databases

-=| Peter Palfrader, 23.09.2009 11:42:15 +0200 |=-
> We mirror packages.debian.org on rore.
> After a sync there are still a few apache processes that have the old
> db files open, so after a couple of days rore runs out of disk space.
> Restarting apache every few days isn't really that great an option,
> so it'd be nice if this could be fixed somehow.

Looking at the code, the DB files are open using the following logic 
(lib/Packages/DB.pm, init()):

(assuming persistent mod_perl environment)

 * at the start of each CGI process, open the DB files and store aside 
   their timestamp
 * when a request comes to an old CGI process and the DB files are 
   modified (using the stored timestamp), close the DB files and 
   reopen them. store the timestamp aside

To me it seems that with the above schema as long as all apache 
children get a request from time to time (and the db files are 
changed), file handles should be closed sooner than "days".

Old file handles could be kept open only if the apache child that 
holds them doesn't receive any requests.

One way to avoid this could be to use alarm() and untie the databases 
in $SIG{ALRM}. Not really nice, admittedly, not to mention that ALRM 
may already be used for something else or interfere with apache.

Another way could be to close DB handles after each request. I am not 
sure how much is gained by caching them forever.

Attachment: signature.asc
Description: Digital signature

Reply to: