|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Cronolog idle with open file descriptiors
Hello all,
I sent a patch a few days ago to Andrew to help improve the situation
where an idle Apache child process' cronolog process will keep a file
descriptor to a log file open long after that file should be closed.
I've done some testing on this and it seems to work, but I am not
running this patch on production machines yet. This patch is against
1.6.2 in cronolog.c:
312a313,333
> /* Wait 60 seconds before closing a log file if we are idle
*/
> /* reset this each time we loop, because select will reset
*/
> fd_set rfds;
> struct timeval tv;
> int retval;
> tv.tv_sec = 60;
> tv.tv_usec = 0;
> FD_ZERO(&rfds);
> FD_SET(0, &rfds);
> retval = select(1, &rfds, NULL, NULL, &tv);
> if (retval == 0)
> {
> DEBUG(("Timeout waiting for data, retval = %d\n",
retval));
> if (log_fd >= 0)
> {
> DEBUG(("Closing log files since we have been idle too
long.\n"));
> close(log_fd);
> log_fd = -1;
> }
> }
Its just inside the main loop. I think 60 seconds should be a long
enough idle time, but this could either be made longer (5 mins?) or
configurable. However, if the cronolog is idle enough to suffer from
this, then closing a file descriptor and then opening the same one again
shouldn't hurt. *shrug*
Anyone want to point out why this is a silly change? ;)
Hope this helps. Regards,
James Bromberger
--
James Bromberger, Webmaster/Senior Systems Administrator
Client Technical Services, Hartleys Limited, www.hartleys.com.au
www.jdv.com
P: +61 8 9268 2909 M: +61 417 322 500
F: +61 8 9266 0200 E: james_bromberger@xxxxxxxxxxxxxxx
Hartleys Ltd ABN 67 009 136 029, its Directors and Associates declare
that they from time to time hold interests in/and or earn brokerage,
fees or other benefits mentioned in documents to clients.
Any securities recommendation contained in this document is unsolicited
general information only. Do not act on a recommendation without first
consulting your investment advisor to determine whether the
recommendation is appropriate for your investment objectives, financial
situation and particular needs.
Hartleys Limited believes that any information or advice (including any
securities recommendation) contained in this document is accurate when
issued. However, Hartleys Limited does not warrant its accuracy or
reliability. Hartleys Limited, its officers, agents and employees exclude
all liability whatsoever, in negligence or otherwise, for any loss or
damage relating to this document to the full extent permitted by law.
Hartleys Limited may collect information from you in order to provide
any services you have requested. A copy of Hartleys Limited's privacy
policy is available on www.hartleys.com.au.
|