hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jaya Christina B" <bj...@mahindrabt.com>
Subject Using MultiThreadedHttpConnectionManager results in java.lang.OutOfMemoryError
Date Mon, 12 Dec 2005 05:35:45 GMT

Hello,

I'm using HttpClient V2.0 on Sun Solaris/WebLogic7.0

The code I am using is:-
HttpClient httpClient = new HttpClient(new
MultiThreadedHttpConnectionManager());
httpClient.getHostConfiguration().setHost(host, port);
HttpMethod httpMethod = new GetMethod(url);
httpClient.executeMethod(httpMethod);
httpMethod.releaseConnection();

The problem I am facing is that after around 2000 connections, this
results in java.lang.OutOfMemoryError.

Looks like, even after call is made and finished by calling
releaseConnection() method, the thread does not get finished and keeps
on waiting forever.  Hence it creates a thread every time this
functionality is called. 

The weblogic's RequestDispatcher  then throws the exception:
javax.servlet.ServletException: unable to create new native thread

I have a wrapper class to HttpClient API & create only one connection
per HttpClient object, so I think using
MultiThreadedHttpConnectionManager is NOT required.
Please could you have a look at this and let me know your thoughts on
this. Could I simply use HttpClient's default constructor without
MultiThreading?

Thanks a lot, in advance.

Regards,
Jaya

The logs are as follows.
--------------------------------
####<29-Nov-05 11:57:54 GMT> <Error> <HTTP> <btnsc003-ukbg>
<managed1_blwlp001> <ExecuteThread: '1' for queue: 'default'> <kernel
identity>
<> <101020>
<[ServletContext(id=4834778,name=btportal_webapp,context-path=/btPortal)
] Servlet failed with Exception>
java.lang.OutOfMemoryError: unable to create new native thread
        at java.lang.Thread.start(Native Method)
        at
org.apache.commons.httpclient.util.TimeoutController.execute(TimeoutCont
roller.java:95)
        at
org.apache.commons.httpclient.util.TimeoutController.execute(TimeoutCont
roller.java:116)
        at
org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:67
5)
        at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpCon
nectionAdapter.open(MultiThreadedHttpConnectionManager.ja
va:959)
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:6
61)
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:5
29)
        at
com.bt.btcom.domain.dao.HttpClientDAO.executeMethod(HttpClientDAO.java:4
65)
        at
com.bt.btcom.domain.dao.HttpClientDAO.executeConnection(HttpClientDAO.ja
va:308)
        at
com.bt.btcom.presentation.util.tsso.BVUrlConnectionHelper.openDAOConnect
ion(BVUrlConnectionHelper.java:114)
        at
com.bt.btcom.presentation.util.tsso.BVUrlConnectionHelper.getResponse(BV
UrlConnectionHelper.java:52)
        at
com.bt.btcom.presentation.util.tsso.BVLoginHelper.login(BVLoginHelper.ja
va:103)
        at
com.bt.btcom.presentation.util.tsso.ApplicationContext.processLogin(Appl
icationContext.java:99)
        at
com.bt.btcom.presentation.util.tsso.SingleSignOn.login(SingleSignOn.java
:92)
        at
com.bt.btcom.presentation.util.tsso.SSOFilter.doFilter(SSOFilter.java:14
5)
        at
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:
27)
        at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.r
un(WebAppServletContext.java:5523)
        at
weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceMa
nager.java:685)
        at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServl
etContext.java:3156)
        at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.
java:2506)
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:234)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:210)
####<29-Nov-05 11:57:54 GMT> <Error> <HTTP> <btnsc003-ukbg>
<managed1_blwlp001> <ExecuteThread: '1' for queue: 'default'> <kernel
identity>
<> <101107>
<[ServletContext(id=4834778,name=btportal_webapp,context-path=/btPortal)
] Problem sending error page>
javax.servlet.ServletException: unable to create new native thread
        at
weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatche
rImpl.java:327)
        at
weblogic.servlet.internal.ServletResponseImpl.sendError(ServletResponseI
mpl.java:517)
        at
weblogic.servlet.internal.ServletResponseImpl.sendError(ServletResponseI
mpl.java:370)
        at
weblogic.servlet.internal.WebAppServletContext.handleException(WebAppSer
vletContext.java:3374)
        at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServl
etContext.java:3202)
        at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.
java:2506)
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:234)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:210)





*********************************************************
Disclaimer:

The contents of this E-mail (including the contents of the enclosure(s) or attachment(s) if
any) are privileged and confidential material of MBT and should not be disclosed to, used
by or copied in any manner by anyone other than the intended addressee(s).   In case you are
not the desired addressee, you should delete this message and/or re-direct it to the sender.
 The views expressed in this E-mail message (including the enclosure(s) or attachment(s) if
any) are those of the individual sender, except where the sender expressly, and with authority,
states them to be the views of MBT.

This e-mail message including attachment/(s), if any, is believed to be free of any virus.
 However, it is the responsibility of the recipient to ensure that it is virus free and MBT
is not responsible for any loss or damage arising in any way from its use

*********************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message