Re: [Javaserver-perl] RE: Perl process hangs on new Java(...) call
Brought to you by:
zzo
From: <ma...@zz...> - 2004-10-14 17:03:55
|
Wow that's a lotta threads in not so much memory. Yah try to socket timeout but a more fundamental problem is JavaServer hanging - prolly running out of memory - look a 'top' next time that happens & see what the Java process is doing... M On Thu, Oct 14, 2004 at 09:48:24AM -0700, Jordan Redner wrote: > It's hard to reproduce. It seems to happen when the machine is under > high CPU load. > > The JavaServer typically does have a lot of threads and does run for > long periods of time. I just checked a production machine and there are > 133 threads (ps -ef on Linux) total memory is 151 MB. > > Thinking about putting a socket timeout in Java.pm... even though it's > running on localhost, what do you think? > > > > Jordan > > > -----Original Message----- > From: ma...@zz... [mailto:ma...@zz...] > Sent: Thursday, October 14, 2004 8:29 AM > To: Jordan Redner > Cc: jav...@li... > Subject: Re: [Javaserver-perl] RE: Perl process hangs on new Java(...) > call > > Can you telnet to 127.0.0.1 port 2000? > Then try: > > #!perl > > use IO::Socket; > my $socket = IO::Socket::INET->new > ( > PeerAddr => '127.0.0.1', > PeerPort => 2000, > ); > > & see if that hangs. > Does it hang all of the time or only sometimes? Maybe it's the > JavaServer > process itself that's hanging. Hm. If only sometimes is it after > JavaServer > has been running for a while w/lots of objects? > I don't think upgrading to 4.7 will help - it's better handling for Java > protected fields. > M > > > On Thu, Oct 14, 2004 at 08:03:30AM -0700, Jordan Redner wrote: > > Thanks so much for the fast response. > > > > Server port is always 127.0.0.1 > > > > OS is a couple years old. > > > > Mandrake: Linux sj7 2.4.19-16mdkenterprise #1 SMP Fri Sep 20 17:34:59 > > CEST 2002 i686 > > > > Perl version 5.8.0 > > > > > > > > Do you think upgrading from 4.6 to 4.7 will help? Are there any > > synchronization issues which were fixed or anything like that? When I > > read "better handling of private/protected fields/functions...", I > > wasn't sure of what this meant internally. JavaServer runs on several > > production machines, otherwise I'd just go ahead and try it. > > > > My next step is to install a timeout parm. in the socket constructor > > inside Java.pm. What are your thoughts on this?? > > > > > > Thanks for your help. > > > > > > > > Jordan > > > > > > -----Original Message----- > > From: ma...@zz... [mailto:ma...@zz...] > > Sent: Wednesday, October 13, 2004 9:33 PM > > To: Jordan Redner > > Cc: jav...@li... > > Subject: Re: Perl process hangs on new Java(...) call > > > > The only interesting thing the Java.pm constructor does that may cause > > it to hang is trying to connect to the remove JavaServer java process. > > Try to telnet to port 2000 of your JavaServer machine from the machine > > running the perl code to ensure you can make a connection between the > > two. > > Of course you'll want to make sure you're running compatible version > > of Java.pm & JavaServer (the major version numbers match). > > Perhaps your DNS is screwey & your JavaServer host is not be resolved? > > As to why it stays hung - which operating system are you running on? > > If perl is 'hung' in a system call (socket connect) perhaps the > > signal never gets sent. > > Lemmie know how it goes - we'll get it figured out. > > Mark > > > > PS there is a mailing list at sourceforge that you should join (very > low > > traffic) for questions such as these: > > http://lists.sourceforge.net/lists/listinfo/javaserver-perl > > > > > > On Wed, Oct 13, 2004 at 05:23:47PM -0700, Jordan Redner wrote: > > > Hi, I hope you can help. I'm using your product as a way to migrate > > > some code from Perl to Java so it's a pretty key piece to our > > strategy. > > > > > > > > > > > > > > > Even though we put in alarms, we still end up with hung perl > > processes. > > > The processes seem to be hung on the line below that is bold, or > when > > it > > > calls out to > > > > > > $java = new Java(host => $perlJavaHost, > > > > > > port => $perlJavaPort, > > > > > > event_port => -1, > > > > > > use_tied_arrays => 1 > > > > > > ); > > > > > > > > > > > > Do you have any idea what we can do to solve this problem? Was this > a > > > known problem. The javaServer itself is very stable. This is the > > only > > > problem we know about. Is there a way to specify a timeout in the > > > connection request? > > > > > > > > > > > > Thanks so much in advance for any help you can provide. > > > > > > > > > > > > > > > > > > sub getJava { > > > > > > my ($perlJavaHost,$perlJavaPort,$javaServerRunner,$timeout) = > @_; > > > > > > > > > > > > my $java; > > > > > > > > > > > > my $retries = 0; > > > > > > > > > > > > while ($retries < 2) { > > > > > > > > > > > > $retries ++; > > > > > > > > > > > > ## -- reset the timer for timeout before the eval block > > > > > > alarm 0; > > > > > > > > > > > > eval { > > > > > > local $SIG{ALRM} = sub { > > > > > > ## -- Signal handler to catch the ALRM signal > > > > > > ## -- log the timeout error and continue next > > iteration > > > > > > lib::perl::Infra::Log::Print("-- Timedout on the > > > JavaServer trying to get a Java object instance --"); > > > > > > next; > > > > > > }; > > > > > > > > > > > > lib::perl::Infra::Log::Print("-- Setting JavaServer > alarm > > > to: $timeout --"); > > > > > > > > > > > > alarm $timeout; > > > > > > > > > > > > $java = new Java(host => $perlJavaHost, > > > > > > port => $perlJavaPort, > > > > > > event_port => -1, > > > > > > use_tied_arrays => 1 > > > > > > ); > > > > > > > > > > > > lib::perl::Infra::Log::Print("-- Successfully obtained a > > > Java object --"); > > > > > > > > > > > > ## -- reset the timer for timeout > > > > > > alarm 0; > > > > > > }; > > > > > > > > > > > > if (defined $java) { > > > > > > return $java; > > > > > > } else { > > > > > > my $err = ""; > > > > > > if ($@) { $err = $@; } > > > > > > > > > > > > if ($main::gLogger){ > > > > > > $err = "JavaUtil.pm" . "," . "Failed obtaining Java > > object, > > > retry count=$retries " . "\n$err"; > > > > > > $main::gLogger->Log("ERROR",$err); > > > > > > } else { > > > > > > $err = "Failed obtaining Java object, retry > count=$retries > > " > > > . "\n$err"; > > > > > > lib::perl::Infra::Log::Print ($err); > > > > > > } > > > > > > > > > > > > restartJavaServer($javaServerRunner); > > > > > > sleep 5; > > > > > > } > > > > > > } > > > > > > > > > > > > return(undef); > > > > > > > > > > > > } > > > > > > > > > > > > > > > > > > > > > > > > Jordan > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: IT Product Guide on > ITManagersJournal > > Use IT products in your business? Tell us what you think of them. Give > us > > Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out > more > > http://productguide.itmanagersjournal.com/guidepromo.tmpl > > _______________________________________________ > > Javaserver-perl mailing list > > Jav...@li... > > https://lists.sourceforge.net/lists/listinfo/javaserver-perl > |