OCSInventory problem

Hello there everyone.

I have installed OCSInventory on 46 of my RHEL5 servers. But when the process is running after some time it makes this processes exp:

After a ps -ef |grep ocs here is what I get :

root      3073 28258  0 15:51 ?        00:00:00 [ocsinventory-ag] <defunct>
root      6459 17165  0 16:05 pts/0    00:00:00 grep ocs
root     28258     1  0 14:15 ?        00:00:02 /usr/bin/perl /usr/bin/ocsinventory-agent -d
root     30447 28258  0 15:01 ?        00:00:00 [ocsinventory-ag] <defunct>

Does someone know where can this com from ? If I restart the process everithing is ok for a while and after I see again [ocsinventory-ag] <defunct> processes.

Thank you for your help

You can use lsof to see what file descriptors are attached to the offending processes.

Thanks for the response.

I get this :

COMMAND   PID USER   FD   TYPE DEVICE     SIZE       NODE NAME
ocsinvent 639 root  cwd    DIR  253,0     4096          2 /
ocsinvent 639 root  rtd    DIR  253,0     4096          2 /
ocsinvent 639 root  txt    REG  253,2    14788     524700 /usr/bin/perl
ocsinvent 639 root  mem    REG  253,2    11924     101422 /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Fcntl/Fcntl.so
ocsinvent 639 root  mem    REG  253,2    31328     101385 /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Data/Dumper/Dumper.so
ocsinvent 639 root  mem    REG  253,2    22448     101604 /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/PerlIO/encoding/encoding.so
ocsinvent 639 root  mem    REG  253,2    75284     102434 /usr/lib/libz.so.1.2.3
ocsinvent 639 root  mem    REG  253,2   174508     106465 /usr/lib/libgssapi_krb5.so.2.2
ocsinvent 639 root  mem    REG  253,2   157196     106463 /usr/lib/libk5crypto.so.3.0
ocsinvent 639 root  mem    REG  253,2   115264     101450 /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/POSIX/POSIX.so
ocsinvent 639 root  mem    REG  253,0    21848     131112 /lib/libnss_dns-2.5.so
ocsinvent 639 root  mem    REG  253,2     6180     101639 /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Sys/Hostname/Hostname.so
ocsinvent 639 root  mem    REG  253,2   105664     197093 /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/auto/Net/CUPS/CUPS.so
ocsinvent 639 root  mem    REG  253,2   216592     106472 /usr/lib/libcups.so.2
ocsinvent 639 root  mem    REG  253,2    13376     105044 /usr/lib/libgpg-error.so.0.3.0
ocsinvent 639 root  mem    REG  253,0   280464     133339 /lib/libssl.so.0.9.8b
ocsinvent 639 root  mem    REG  253,2   509840     106471 /usr/lib/libgnutls.so.13.0.6
ocsinvent 639 root  mem    REG  253,2   360160     196727 /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/auto/Net/SSLeay/SSLeay.so
ocsinvent 639 root  mem    REG  253,2    64076     196910 /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/auto/Compress/Zlib/Zlib.so
ocsinvent 639 root  mem    REG  253,0    48524     133371 /lib/libnss_files-2.5.so
ocsinvent 639 root  mem    REG  253,2    14032     101395 /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Digest/MD5/MD5.so
ocsinvent 639 root  mem    REG  253,2    36376     101443 /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/List/Util/Util.so
ocsinvent 639 root  mem    REG  253,0   121684     133314 /lib/ld-2.5.so
ocsinvent 639 root  mem    REG  253,0  1576952     133315 /lib/libc-2.5.so
ocsinvent 639 root  mem    REG  253,0    16528     133318 /lib/libdl-2.5.so
ocsinvent 639 root  mem    REG  253,0   208344     133317 /lib/libm-2.5.so
ocsinvent 639 root  mem    REG  253,0   125564     133324 /lib/libpthread-2.5.so
ocsinvent 639 root  mem    REG  253,2  1241272     105694 /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
ocsinvent 639 root  mem    REG  253,0    27836     133329 /lib/libcrypt-2.5.so
ocsinvent 639 root  mem    REG  253,0   101036     133336 /lib/libnsl-2.5.so
ocsinvent 639 root  mem    REG  253,2   347700     106470 /usr/lib/libgcrypt.so.11.2.2
ocsinvent 639 root  mem    REG  253,2    33940     101410 /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Encode/Encode.so
ocsinvent 639 root  mem    REG  253,2    16260     101437 /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/IO/IO.so
ocsinvent 639 root  mem    REG  253,0     7720     133338 /lib/libcom_err.so.2.1
ocsinvent 639 root  mem    REG  253,0  1238928     133334 /lib/libcrypto.so.0.9.8b
ocsinvent 639 root  mem    REG  253,2    18432     101425 /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/File/Glob/Glob.so
ocsinvent 639 root  mem    REG  253,0    76392     133337 /lib/libresolv-2.5.so
ocsinvent 639 root  mem    REG  253,2   559532     106464 /usr/lib/libkrb5.so.3.2
ocsinvent 639 root  mem    REG  253,2    30596     106462 /usr/lib/libkrb5support.so.0.1
ocsinvent 639 root  mem    REG  253,2    78548     101615 /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Storable/Storable.so
ocsinvent 639 root  mem    REG  253,2    20424     101612 /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Socket/Socket.so
ocsinvent 639 root  mem    REG  253,2     9032     101379 /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Cwd/Cwd.so
ocsinvent 639 root  mem    REG  253,0    15264     133340 /lib/libutil-2.5.so
ocsinvent 639 root  mem    REG  253,2 55565760     100745 /usr/lib/locale/locale-archive
ocsinvent 639 root    0u   CHR    1,3                1920 /dev/null
ocsinvent 639 root    1u   CHR    1,3                1920 /dev/null
ocsinvent 639 root    2u   CHR    1,3                1920 /dev/null
ocsinvent 639 root    3r   REG  253,2    11721     197065 /usr/lib/perl5/vendor_perl/5.8.8/Proc/PID/File.pm
ocsinvent 639 root    4r   CHR    1,9                2607 /dev/urandom
ocsinvent 639 root    5r   REG    0,3        0 4026531851 /proc/cpuinfo
ocsinvent 639 root    6r   REG    0,3        0 4026531842 /proc/meminfo

I can see that is coming from perl but don't know how to correct this bug

Reference

---------- Post updated at 15:32 ---------- Previous update was at 15:18 ----------

Also, before running the debugger, the perl man page recommends:

Thanks for your help rely.
I was taking a look at this -d option but in all the scripts this is the -d option dor the deamon and debug. But it I put -w the process fails to start. Why can't I run it without this option ?

Might be easier to create an alias (or wrapper, what ever you want to call it) for perl with the -w option in the alias/wrapper, and have the alias call perl (with the -w option) and redirect any warning messages to a log file.

---------- Post updated at 05:53 ---------- Previous update was at 05:51 ----------

You should look in the log files for perl error messages.

We can't see your log files from here :smiley: (especially since you are not posting any error messages)

There are no error messages.. In the log files I have this :

[Tue Oct 26 04:30:26 2010][info] Going to sleep for 1048 second(s)
[Tue Oct 26 04:48:12 2010][info] Going to sleep for 1875 second(s)
[Tue Oct 26 05:22:26 2010][info] Going to sleep for 1549 second(s)
[Tue Oct 26 05:48:46 2010][info] Going to sleep for 1666 second(s)
[Tue Oct 26 06:19:20 2010][info] Going to sleep for 3089 second(s)
[Tue Oct 26 07:13:21 2010][info] Going to sleep for 520 second(s)
[Tue Oct 26 07:22:25 2010][info] Going to sleep for 811 second(s)
[Tue Oct 26 07:36:14 2010][info] Going to sleep for 1889 second(s)
[Tue Oct 26 07:53:26 2010][info] Going to sleep for 882 second(s)
[Tue Oct 26 08:10:45 2010][info] Going to sleep for 542 second(s)
[Tue Oct 26 08:20:06 2010][info] Going to sleep for 2926 second(s)

So what you'r saying is to make an alias with a command like this :

/usr/bin/perl -w /usr/bin/ocsinventory-agent -d

The problem is that if I take out the -d option it wont run as a daemon and after a time the process stops. I checked the man of ocs and the -d option is for debug and daemon.

Just use the -w option at first, not -d (the man page also recommends this... it says, try the -w option first, not at the same time as the -d option).

Also, check the man pages to find out where the warning messages are logged. You should redirect them to a log file.

---------- Post updated at 08:06 ---------- Previous update was at 07:47 ----------

Also, the wrapper/alias should work the same as your standard perl command, but it also uses the -w option. There are a number of ways to accomplish this.

The bottom line is that, unless you have logging information, you can't debug very well. Perl has facilities for logging warnings, debugging, etc. You need to use these tools.

Thanks for the help.. I'll search more in to these logs.. I'll get back to you if I find something new.