RE: Tomcat causes Apache to hang. Any ideas?

2004-08-25 Thread Brad McEvoy

I had a similar problem on RH EL just a couple of weeks ago. Might not be
the same as yours, though, because in my case apache wasnt hung, just
tomcat. but that might just be a difference in versions, so i'll share it
anyway.

Here's what i did..

I used kill -QUIT on the tomcat process after it had hung to find a stack
trace of the tomcat threads. This showed that every thread was blocked on a
synchronized statement in program code. I investigated it (thoroughly!) and
concluded that there is a bug in the JVM on this OS related to synchronized
statements, only manifesting itself occasionally and under certain
conditions. I refactored my code slightly around this and it appears to have
fixed the problem.

I'd be interested in hearing how it works out for you.

-Original Message-
From: Sean Finkel [mailto:[EMAIL PROTECTED]
Sent: Thursday, 26 August 2004 2:07 AM
To: Tomcat User
Subject: Tomcat causes Apache to hang. Any ideas?


Hello,
First a brief background on the setup:
We are running Apache 1.3.31 utilizing mod_jk (not jk2). We are running 
two instances of Tomcat. Previously, both were version 4. Currently, we 
have one shared instance running the latest 5.x release (just compiled 
yesterday). We have one customer running a private 4.x instance.

With that said, we just moved to a new server (Dual Xeon, RHEL 3.0) and 
now the problem we are having is the customer who has this private 
instance has jsp pages that "hang". But, it does not hang all the time. 
What's weird, is most of the time, I can stop the shared instance and 
the customer's pages will stop hanging. I would like to fix the hanging 
completely, obviously.

Today though, the only thing that kept his pages from hanging was a full 
reboot. I am wondering if this is related to swap space usage. I don't 
know what else it would be, as I stopped/started his tomcat and apache 
numerous times. I tried using a different connector (AJP instead of Coyote).

Could this last problem be due to running tomcat5 *and* tomcat 4? I 
would say no, as that makes no sense this would be the case, especially 
when it (still)occurred after stopping the Tomcat 5 instance.

Essentially what happens is, Apache receives the request for the page, 
hands it off to Tomcat, tomcat returns half of the page (header/left 
menu) and just sits there. Hitting "stop" on the browser stops the 
transfer, however Tomcat never releases the Apache process. So we end up 
with dozens, sometimes hundreds of Apache processes that are "hung" by 
tomcat. This results in memory usages exceeding 2gb!

Has anyone experienced similar problems or have any suggestions?

-Sean Finkel


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Help with a real ugly one

2004-08-22 Thread Brad McEvoy

If you havent already done it, next time it goes crazy try to get a stack
trace of all threads with kill -QUIT. 



-Original Message-
From: John Villar [mailto:[EMAIL PROTECTED]
Sent: Saturday, 21 August 2004 12:16 AM
To: Tomcat Users List
Subject: Re: Help with a real ugly one


how many traffic does have your site? it could be that you're having 
lots of hits that's just fine with me :-D
Also, check the connection time out, maybe you have lots of connections 
lingering on your server. also, check if its from a set of IPs or 
just one IP that's hitting you *could* be an attack (unlikely, but 
could be)

Randy Paries escribió:

>Hello all,
>
>I have this problem that I am looking for any kind of help
>
>I am not sure what is causing it, I just know how It shows itself
>
>A couple of logistical things
>RH9
>jakarta-tomcat-5.0.24
>Apache 2
>
>So here is the problem.
>Every once in a while, my httpd and java(tomcat) process go thru the roof
>until I run out of threads or max out clients. 
>
>For example this morning I was averaging 40 http processes and 50 java
>processes. With in 10 minutes I go to 400 http process and 430 java
>processes. 
>
>I am trying to go thru all the log files but there is nothing so far(the
>access logs are huge and still trying to see a pattern.), but the servlet
>logs and tomcat logs there is nothing. 
>
>Once I restart everything, life is fine for days or hours. This really
never
>picks a particular time.
>
>I realize this is still pretty general, and that's what I have been
fighting
>for months.
>
>Any help would really be appreciated. I have a script that runs every 5
>minutes that counts the procs and if it goes over a threshold I get a text
>message. So I have a log of process every 5 
>
>Thanks
>randy
>
>
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>  
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: problem inserting Blob into database

2004-08-19 Thread Brad McEvoy

I'm using Clob's with oracle at the mo, and i've found that the standard
ResultSet interface has everything we need, but the Clob (or Blob) is the
thing which needs to be cast to an oracle specific class

public ResultSet rs;
public Clob clob;
...
rs = cmd.executeQuery();
clob = rs.getClob(1);
oracle.sql.CLOB c = (oracle.sql.CLOB)clob;
os = c.getAsciiOutputStream();
...

Although i'm not using dbcp, i think this should work for you as the
DelegatingResultSet's getBlob method should return the Blob which the actual
underlying OracleResultSet created, which will be a oracle.sql.CLOB


-Original Message-
From: Carey Boldenow [mailto:[EMAIL PROTECTED]
Sent: Friday, 20 August 2004 12:11 AM
To: 'Tomcat Users List'
Subject: problem inserting Blob into database


Hi,

 

I have some code that works fine in weblogic, but throws a
ClassCastException in Tomcat (v5.0.19). The code snippet below is where
it is failing

 

if (rs.next()) {

BLOB blob =
((OracleResultSet)rs).getBLOB(1);

 

The ResultSet instance apparently is of type
org.apache.commons.dbcp.DelegatingResultSet. I don't want to code to
that type since that is not too portable to other app servers.
Ultimately, I am trying to get an OutputStream object from the Blob. The
latest version of java.sql.Blob has a setBinaryStream method which
returns an OutputStream, however, even the latest versions of the Oracle
drivers apparently do not support this.

 

Regards,

Carey


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[OFF-TOPIC] RE: Is there a way to set the size of ResultSet from MS SQL Serve r

2004-08-19 Thread Brad McEvoy

thats true, but now i think about it, why would anyone use the JDBC driver
to connect to SQL Server? The JDBC driver is the worst one i've used and the
MS native driver is probably the best.

Out of curiosity I profiled the difference setFetchSize makes. Set to 100 on
Oracle it improves the time to iterate over 1000 records by 5-10% compared
to not using it at all, and actually slows it down by that much if a large
fetch size (>1000) is set. This surprised me because i first started using
this on a project with sql server with the native driver and it made a huge
improvement

-Original Message-
From: John Villar [mailto:[EMAIL PROTECTED]
Sent: Thursday, 19 August 2004 10:26 PM
To: Tomcat Users List
Subject: Re: Is there a way to set the size of ResultSet from MS SQL
Serve r


However, that would work only if the driver you're using uses the 
FetchSize as a hint for caching records. In JDBC caching is primarily 
the responsability of the Driver.

Brad McEvoy escribió:

>something like this should do the trick
>
>...
>PreparedStatement pstmt =
>con.prepareStatement(sql,ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_
O
>NLY);
>pstmt.setFetchSize(100);
>ResultSet rs = pstmt.executeQuery();
>...
>
>
>-Original Message-
>From: QM [mailto:[EMAIL PROTECTED]
>Sent: Thursday, 19 August 2004 2:04 PM
>To: Tomcat Users List
>Subject: Re: Is there a way to set the size of ResultSet from MS SQL
>Server
>
>
>On Wed, Aug 18, 2004 at 04:50:32PM -0700, Daxin Zuo wrote:
>: I use JDBC in JSP/Java with MS SQL Server.
>: Is there a way to set the Fetch Size (set to 10, 100,..) of ResultSet (as
>: ADO CacheSize  in ASP)?
>
>This sounds like a configuration specific to your database, either with
>a custom SQL statement (a la HSQLDB) or with a JDBC URL param...
>
>Unless you mean you want to limit the results using the clause
>"LIMIT x" in your SQL.
>
>-QM
>
>  
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Is there a way to set the size of ResultSet from MS SQL Serve r

2004-08-18 Thread Brad McEvoy

something like this should do the trick

...
PreparedStatement pstmt =
con.prepareStatement(sql,ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_O
NLY);
pstmt.setFetchSize(100);
ResultSet rs = pstmt.executeQuery();
...


-Original Message-
From: QM [mailto:[EMAIL PROTECTED]
Sent: Thursday, 19 August 2004 2:04 PM
To: Tomcat Users List
Subject: Re: Is there a way to set the size of ResultSet from MS SQL
Server


On Wed, Aug 18, 2004 at 04:50:32PM -0700, Daxin Zuo wrote:
: I use JDBC in JSP/Java with MS SQL Server.
: Is there a way to set the Fetch Size (set to 10, 100,..) of ResultSet (as
: ADO CacheSize  in ASP)?

This sounds like a configuration specific to your database, either with
a custom SQL statement (a la HSQLDB) or with a JDBC URL param...

Unless you mean you want to limit the results using the clause
"LIMIT x" in your SQL.

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Error with "All threads (...) are currently busy" on Red Hat

2004-08-05 Thread Brad McEvoy

Our tomcat server freezes intermittently, without any identifiable cause,
giving a message like "All threads (xxx) are currently busy, waiting". At
first I assumed that some bug with our java code was causing requests to
hang indefinitely and they were accumulating over time to cause this, but
I've added diagnostics code to detect that condition and it appears not to
be the case.

A similar problem was reported recently at
http://www.mail-archive.com/[EMAIL PROTECTED]/msg132875.html

However, the resolution to that referred to problematic versions which we
aren't using

Our exact versions are below..

linux Red Hat EL
kernel 2.4.21-17.ELsmp  (as per recommendation on Bug 120341 for ibm blades)
tomcat 4.1.30
apache 2.0.49
mod_jk 2.04
glibc 2.3.2-95.20
java 1.4.2_02 - Sun VM


Any help would be greatly appreciated,
Brad McEvoy

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]