Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Mar 2006 04:22:44 GMT
From:      "Eugene M. Zheganin" <emz@norma.perm.ru>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/95022: sarg 2.1 fopen() leak
Message-ID:  <200603280422.k2S4Mi2M086151@www.freebsd.org>
Resent-Message-ID: <200603280430.k2S4UGkI048282@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         95022
>Category:       ports
>Synopsis:       sarg 2.1 fopen() leak
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 28 04:30:15 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Eugene M. Zheganin
>Release:        FreeBSD 6.1-PRERELEASE
>Organization:
>Environment:
FreeBSD ns.hq.norma.perm.ru 6.1-PRERELEASE FreeBSD 6.1-PRERELEASE #1: Sat Mar 25 12:42:23 YEKT 2006     emz@ns.hq.norma.perm.ru:/usr/obj/usr/src/sys/NS-HQ  i386
>Description:
When sarg 2.1 uses external_css_file it opens it on each created html and forgets to fclose(). When he have to create 15000 htmls - he creates them successfully (each current html is properly closed when working on it is done) bus external css remains open. This overflows different system filecounters and when some limit is reached sarg crashes with "Too many open files". Some messages in this forum are related to this problem, but dont point on it directly. I have a sample 'lsof' output, can provide it if needed, but here I will just post a 'grep' + 'wc -l' results. Consider /usr/local/www/data.tech/main.css as my external css file. 
 
# grep /usr/local/www/data.tech/main.css openfiles.txt | wc -l 
9713 
 
I really think this needs to be fixed.

>How-To-Repeat:
Use external_css_file with some CSS data.
Build a report on a large period with loads of *.html files to be created.
>Fix:
--- css.c.orig  Tue Mar 28 10:09:53 2006
+++ css.c       Tue Mar 28 09:58:45 2006
@@ -39,6 +39,7 @@
       fputs("<style>\n",fp_ou);
       while(fgets(buf,MAXLEN,fp_in)!=NULL)
          fputs(buf,fp_ou);
+      fclose(fp_in);
       fputs("</style>\n",fp_ou);
       return;
    }

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603280422.k2S4Mi2M086151>