in reply to Re: perl process hangs after processing the last file.
in thread perl process hangs after processing the last file.

Hi cdarke, I cannot paste the code as its confidential. btw strace info is as follows:
strace -fe verbose=all -p 19881 Process 19881 attached - interrupt to quit read(7, ls -l /proc/19881/fd/ total 0 lr-x------ 1 root root 64 Jan 17 20:02 0 -> pipe:[1771023532] l-wx------ 1 root root 64 Jan 17 20:02 1 -> pipe:[1771023666] l-wx------ 1 root root 64 Jan 17 20:02 2 -> pipe:[1771023533] lrwx------ 1 root root 64 Jan 17 20:02 3 -> socket:[1771025115] lr-x------ 1 root root 64 Jan 17 20:02 4 -> /opt/opwv/OKRAuser/3.1.1/E +TL/data/input/rba/abc.log.working lrwx------ 1 root root 64 Jan 17 20:02 7 -> socket:[1771023680]

Thanks
AvantA

Replies are listed 'Best First'.
Re^3: perl process hangs after processing the last file.
by Anonymous Monk on Jan 18, 2011 at 13:48 UTC

      As a bonus, when you do reduce it to a minimal set of code, you often won't need to post it; the problem and its solution will have become obvious.

Re^3: perl process hangs after processing the last file.
by cdarke (Prior) on Jan 18, 2011 at 16:42 UTC
    OK, so it is reading file descriptor 7, which is a socket. So you need to look at your closedown sequence. How does the writer indicate that there is no further data? Does the reader check for this correctly?
      Hi cdarke,

      after some analysis I found the followin info
      lsof shows it's an IPv4 connection: perl 2221 root 7u IPv4 1768226357 TCP xyz-server.com:38178->xyz-server.com:7891 (ESTABLISHED) Connection to port 7891 - the JVM used /usr/java/jdk1.6.0_21/bin/java org.perl.inline.java.InlineJavaServer 0 + localhost 7891 true false false
      Actually, we are using Inline::Java to use methods in a jar file through perl, basically for SNMP usage. that is the reason for the creation of JVM which is in Shared mode. There is a method which uses the Java module in the 4th Step mentioned in my query above.

      This is called for all the text files but why is it hanging at the last process having the last file, if java module is the cause. So any suggestions on the same.
      Thanks
      AvantA
        The first thing you should test is if the problem vanishes when you disable the SNMP code, i.e. the call to the java library.