RE: [Javaserver-perl] RE: Perl process hangs on new Java(...) call
Brought to you by:
zzo
|
From: Jordan R. <jr...@sh...> - 2004-10-29 19:25:37
|
I found the problem, and indeed it's not in the JavaServer code!
Using perl alarms helped me to isolate what was hanging. Regarding the
large # of threads, closing the Oracle connection really helped!
=20
I have a quick question regarding JavaServer.
In one of my Java classes being created, I am using an Oracle JDBC
client via a non-static Oracle connection instance variable.
In subsequent class creations of the same class, is the object being
newly instantiated or is there a pooled object being reused?
Additionally, do I need to implement any synchronization methods around
methods that make use of the connection for example?
Thanks very much again. =20
Jordan
-----Original Message-----
From: jav...@li...
[mailto:jav...@li...] On Behalf Of
ma...@zz...
Sent: Thursday, October 14, 2004 10:08 AM
To: Jordan Redner
Cc: jav...@li...
Subject: Re: [Javaserver-perl] RE: Perl process hangs on new Java(...)
call
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. =20
>=20
> 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.
>=20
> Thinking about putting a socket timeout in Java.pm... even though it's
> running on localhost, what do you think?
>=20
>=20
>=20
> Jordan
>=20
>=20
> -----Original Message-----
> From: ma...@zz... [mailto:ma...@zz...]=20
> 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
>=20
> Can you telnet to 127.0.0.1 port 2000?
> Then try:
>=20
> #!perl
>=20
> use IO::Socket;
> my $socket =3D IO::Socket::INET->new
> (
> PeerAddr =3D> '127.0.0.1',
> PeerPort =3D> 2000,
> );
>=20
> & 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
>=20
>=20
> On Thu, Oct 14, 2004 at 08:03:30AM -0700, Jordan Redner wrote:
> > Thanks so much for the fast response.=20
> >=20
> > Server port is always 127.0.0.1
> >=20
> > OS is a couple years old.
> >=20
> > Mandrake: Linux sj7 2.4.19-16mdkenterprise #1 SMP Fri Sep 20
17:34:59
> > CEST 2002 i686=20
> >=20
> > Perl version 5.8.0
> >=20
> >=20
> >=20
> > 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
> >=20
> > My next step is to install a timeout parm. in the socket constructor
> > inside Java.pm. What are your thoughts on this??
> >=20
> >=20
> > Thanks for your help.
> >=20
> >=20
> >=20
> > Jordan
> >=20
> >=20
> > -----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
> >=20
> > 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
> >=20
> > 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
> >=20
> >=20
> > 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
> >=20
> >=20
> >=20
> > -------------------------------------------------------
> > 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
>=20
-------------------------------------------------------
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
|