[Javaserver-perl] RE: Perl process hangs on new Java(...) call
Brought to you by:
zzo
From: Jordan R. <jr...@sh...> - 2004-10-14 14:58:27
|
Thanks so much for the fast response.=20 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=20 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. =20 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...]=20 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. >=20 >=20 > =20 >=20 > 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=20 >=20 > $java =3D new Java(host =3D> $perlJavaHost, >=20 > port =3D> $perlJavaPort, >=20 > event_port =3D> -1, >=20 > use_tied_arrays =3D> 1 >=20 > ); >=20 > =20 >=20 > 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? >=20 > =20 >=20 > Thanks so much in advance for any help you can provide. >=20 > =20 >=20 > =20 >=20 > sub getJava { >=20 > my ($perlJavaHost,$perlJavaPort,$javaServerRunner,$timeout) =3D = @_; >=20 > =20 >=20 > my $java; >=20 > =20 >=20 > my $retries =3D 0; >=20 > =20 >=20 > while ($retries < 2) { >=20 > =20 >=20 > $retries ++; >=20 > =20 >=20 > ## -- reset the timer for timeout before the eval block >=20 > alarm 0; >=20 > =20 >=20 > eval {=20 >=20 > local $SIG{ALRM} =3D sub { >=20 > ## -- Signal handler to catch the ALRM signal >=20 > ## -- log the timeout error and continue next iteration >=20 > lib::perl::Infra::Log::Print("-- Timedout on the > JavaServer trying to get a Java object instance --"); >=20 > next; >=20 > }; >=20 > =20 >=20 > lib::perl::Infra::Log::Print("-- Setting JavaServer alarm > to: $timeout --"); >=20 > =20 >=20 > alarm $timeout; >=20 > =20 >=20 > $java =3D new Java(host =3D> $perlJavaHost, >=20 > port =3D> $perlJavaPort, >=20 > event_port =3D> -1, >=20 > use_tied_arrays =3D> 1 >=20 > ); >=20 > =20 >=20 > lib::perl::Infra::Log::Print("-- Successfully obtained a > Java object --"); >=20 > =20 >=20 > ## -- reset the timer for timeout >=20 > alarm 0; >=20 > }; >=20 > =20 >=20 > if (defined $java) { >=20 > return $java; >=20 > } else { >=20 > my $err =3D ""; >=20 > if ($@) { $err =3D $@; } >=20 > =20 >=20 > if ($main::gLogger){ >=20 > $err =3D "JavaUtil.pm" . "," . "Failed obtaining Java object, > retry count=3D$retries " . "\n$err"; >=20 > $main::gLogger->Log("ERROR",$err); >=20 > } else { >=20 > $err =3D "Failed obtaining Java object, retry = count=3D$retries " > . "\n$err"; >=20 > lib::perl::Infra::Log::Print ($err); >=20 > } >=20 > =20 >=20 > restartJavaServer($javaServerRunner); >=20 > sleep 5; >=20 > } >=20 > } >=20 > =20 >=20 > return(undef); >=20 > =20 >=20 > } >=20 > =20 >=20 > =20 >=20 > =20 >=20 > Jordan >=20 > =20 >=20 |