Stateless Pooling In JBoss AS.
grdzeli_kaci Apr 5, 2010 6:07 AMhi all,
I have strange problem.
My Env:
1. OS Sun Solaris Sparc
2.Application Server jboss-4.2.3.GA
3.java Oracle JRockit(R) version "1.6.0_05"
4.Ext. Lib. Apache http Client (http://hc.apache.org/httpclient-3.x/)
I have one stateless session bean which sends SMS Message to mobile using http client.
my session bean looks like :
@Stateless @Remote(CommonFasade.class) public class CommonFasadeBean implements CommonFasade { private HttpClient httpClient = null; public HttpClient getHttpClient() { if (httpClient == null) { SimpleHttpConnectionManager manager = new SimpleHttpConnectionManager(); manager.getParams().setConnectionTimeout(5000); manager.getParams().setSoTimeout(5000); httpClient = new HttpClient(manager); } return httpClient; } public void sendSMS(String fullSms, String phone, String from) { HttpClient httpClient = getHttpClient(); phone = Utils.trimPhone(phone); phone = getPhone(phone); if (phone == null) { return; } String sendToPhone = null; switch (phone.length()) { case 8: sendToPhone = "%s2B995" + phone; break; case 9: sendToPhone = "%s2B995" + phone.substring(1); break; default: return; } String url = "http://192.168.19.194:13013/cgi-bin/sendsms?from=" + from + "&username=1&password=1&to=" + sendToPhone + "&text=%s"; long sc = -999; try { for (String sms : prepareSmsList(fullSms)) { GetMethod method = new GetMethod(String.format(url, "%", sms)); try { sc = httpClient.executeMethod(method); if (sc == HttpStatus.SC_ACCEPTED) { String response = method.getResponseBodyAsString(); if (response.toLowerCase().indexOf("sent") != -1) { logSMS(sms, phone, from); } } } finally { method.releaseConnection(); } } } catch (Exception e) { e.printStackTrace(); } }
this code worked for tree years, but problem appeard some days ago.
every second or third day my jboss application server crashes.
when i trying to find promlem i found this :
1. into solaris :
"netstat -an|grep 192.168.19.194|wc -l (this is SMS sender HTTP server)"
and result was : 12678
this is client socket connections from my jboss as, all of them is on a CLOSE_WAIT state.
After this when i looking into the jmx-console i found this :
My question is why i have 12826 stateless session bean isntances into as ?
Into my jboss as stateless session pool config max size is 30.
i think that something changed into HTTP Server or into network.
but i need workarount of this porblem .
is this pattern right for using http clients ? Maybe it will be more correct to use MDB for this ?
when current size of my stateless session bean achieve 40000 the jboss is going down.
can anybody help me what should i do ???
___________________
Regards,
Paata Lominadze.
-
MBeanView.jpeg 107.6 KB