Bug#573387: anacron leaks file descriptors

2012-04-17 Thread Peter Eisentraut
On tis, 2012-04-17 at 10:47 +0200, Václav Ovsík wrote:
> Hi Peter,
> 
> On Mon, Apr 16, 2012 at 10:53:17PM +0300, Peter Eisentraut wrote:
> > Calling lvs directly from the command line also shows messages about
> > leaked file descriptors, so I'm not convinced that this is a problem in
> > anacron.
> 
> I don't know what you mean "lvs directly from the command line". I never
> noticed such messages from LVM commands ran from bash, dash.

Well, zsh ... ;-)

>  The only
> other case I noticed is LVM under Midnight Commander. Midnight Commander
> has this problem too. Hmm, I should report this problem on MC too :).

Interesting.  I'm not sure why lvs is in the business of complaining
about file descriptor leaks in its parent processes.  It might be worth
fixing them, but I'd like to understand this a bit better first.

> I ran the Anacron trough strace and after a short inspection of lvs
> message and strace output I found one of leaked descriptors. The
> following attached patch solves the message in the test case.
> 
> Unfortunately I'm afraid it is only a part :(.
> But as I'm looking back on other leaked descriptors I originally
> reported, these are probably inherited from parent processes of Anacron.
> 
> Can you accept the attached patch or rewrite it to your taste (maybe
> report upstream)? I think, that after applying the fix this bug can be
> closed. Other leaked descriptors should be reported to other packages.

I'll look into it.





--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#573387: anacron leaks file descriptors

2012-04-17 Thread Václav Ovsík
Hi Peter,

On Mon, Apr 16, 2012 at 10:53:17PM +0300, Peter Eisentraut wrote:
> Calling lvs directly from the command line also shows messages about
> leaked file descriptors, so I'm not convinced that this is a problem in
> anacron.

I don't know what you mean "lvs directly from the command line". I never
noticed such messages from LVM commands ran from bash, dash. The only
other case I noticed is LVM under Midnight Commander. Midnight Commander
has this problem too. Hmm, I should report this problem on MC too :).

> Also note that anacron is not a long-running process, so even if there
> were a resource leak of some kind, it doesn't necessarily follow that
> that's a problem worth fixing.

Maybe you are right, but bugs should be fixed.

Ok, I will try to inspect this problem a bit deeper...

I ran the Anacron trough strace and after a short inspection of lvs
message and strace output I found one of leaked descriptors. The
following attached patch solves the message in the test case.

Unfortunately I'm afraid it is only a part :(.
But as I'm looking back on other leaked descriptors I originally
reported, these are probably inherited from parent processes of Anacron.

Can you accept the attached patch or rewrite it to your taste (maybe
report upstream)? I think, that after applying the fix this bug can be
closed. Other leaked descriptors should be reported to other packages.

Thanks for your time and work.

Best Regards
-- 
Zito
--- main.c.orig	2012-04-17 09:48:32.0 +0200
+++ main.c	2012-04-17 10:27:49.207407827 +0200
@@ -467,6 +467,7 @@
 
 record_start_time();
 read_tab(cwd);
+if (close(cwd)) die_e("Can't close file descriptor %d", cwd);
 arrange_jobs();
 
 if (testing_only)


Bug#573387: anacron leaks file descriptors

2010-03-10 Thread Vaclav Ovsik
Package: anacron
Version: 2.3-14
Severity: normal

Hi,
while running some system info gathering job in cron.daily used LVM
utilities discovered leaked file descriptors in anacron.
I'm receiving mails from job e.g.:

/etc/cron.daily/sysinfo-local:
File descriptor 3 (/var/run/pm-utils/locks/pm-suspend.lock (deleted)) leaked on 
pvs
+invocation. Parent PID 12898: /bin/sh
File descriptor 4 (/dev/input/event12) leaked on pvs invocation. Parent PID 
12898: /bin/sh
File descriptor 5 (/dev/input/event2) leaked on pvs invocation. Parent PID 
12898: /bin/sh
File descriptor 6 (/dev/input/event3) leaked on pvs invocation. Parent PID 
12898: /bin/sh
File descriptor 7 (/dev/input/event4) leaked on pvs invocation. Parent PID 
12898: /bin/sh
File descriptor 8 (/dev/input/event5) leaked on pvs invocation. Parent PID 
12898: /bin/sh
File descriptor 9 (/) leaked on pvs invocation. Parent PID 12898: /bin/sh
File descriptor 10 (inotify) leaked on pvs invocation. Parent PID 12898: /bin/sh
File descriptor 11 (socket:[208744]) leaked on pvs invocation. Parent PID 
12898: /bin/sh
File descriptor 13 (/dev/input/event14) leaked on pvs invocation. Parent PID 
12898: /bin/sh
...

To reproduce the problem:

bobek:~/a# cat anacrontab 
0   0   anacron.test lvs >/dev/null
bobek:~/a# anacron -s -d -t /root/a/anacrontab 
Anacron 2.3 started on 2010-03-11
Will run job `anacron.test' in 0 min.
Jobs will be executed sequentially
Job `anacron.test' started
Job `anacron.test' terminated (mailing output)
Normal exit (1 job run)

The received mail contains in the body:

File descriptor 3 (/root/a) leaked on lvs invocation. Parent PID 6603: /bin/sh

Regards
-- 
Zito

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (x86_64)

Kernel: Linux 2.6.32-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=cs_CZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages anacron depends on:
ii  debianutils   3.2.2  Miscellaneous utilities specific t
ii  libc6 2.10.2-6   Embedded GNU C Library: Shared lib
ii  lsb-base  3.2-23 Linux Standard Base 3.2 init scrip

Versions of packages anacron recommends:
ii  cron  3.0pl1-106 process scheduling daemon
ii  rsyslog [system-log-daemon]   4.6.1-1enhanced multi-threaded syslogd

Versions of packages anacron suggests:
ii  exim4-daemon-light [mail-tran 4.71-3 lightweight Exim MTA (v4) daemon
ii  powermgmt-base1.31   Common utils and configs for power

-- debconf information excluded



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org