-
1. Re: org.jboss.mq.SpyJMSException: OutOfMemoryError
shiming Apr 15, 2005 3:42 PM (in response to regenwetter)I got the similar error with single JMS client and JMS listener. I just send 1000 messages continuously (sleep 50ms before send a message) . The listener stops receiving message after about 600 messages. The listener doesn't really do anything. It just receives message and print out timestamp. The message size is 1K. Jboss version 4.0.1sp1. Tested with OpenJMS fine with 10,000 messages with 100K message size.
-
2. Re: org.jboss.mq.SpyJMSException: OutOfMemoryError
regenwetter Apr 18, 2005 2:12 AM (in response to regenwetter)Did you find any solution ?
-
3. Re: org.jboss.mq.SpyJMSException: OutOfMemoryError
disrael Apr 18, 2005 7:29 PM (in response to regenwetter)Are you using connection pooling? It seems like you are not and are running out of ability to create new tcp sockets. Would be interested if your test still fails if you use only one connection for all messaging.
-
4. Re: org.jboss.mq.SpyJMSException: OutOfMemoryError
regenwetter Apr 19, 2005 11:53 AM (in response to regenwetter)The JMS Client does not use connection pooling. It does something like that:
public void send(...){ lookupJMSResourcen(); connection = cf.createConnection(); session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE); ... } private static void lookupJMSResourcen() throws Exception{ if (ic == null) ic = new InitialContext(); if (cf == null) cf = (ConnectionFactory) ic.lookup(CONNECTION_FACTORY); if (destination == null) destination = (Destination) ic.lookup(QUEUE); }
The "JMS Server" is a message driven bean.
It is not easy to reproduce the error.
Any ideas ? -
5. Re: org.jboss.mq.SpyJMSException: OutOfMemoryError
disrael Apr 19, 2005 1:19 PM (in response to regenwetter)Move the connection = cf.createConnection();
outside of the send. -
6. Re: org.jboss.mq.SpyJMSException: OutOfMemoryError
regenwetter Apr 20, 2005 4:12 AM (in response to regenwetter)I have already thought of it. But I am closing the connection in a finally block within the send method. I can't do it any longer if I move the statement
connection = cf.createConnection();
outside the send method because of IllegalStateException (or something similar like that). But I have to do it. I think I have two possibilities:
1.) Open for each request a new connection which I have to close after sending the message (current situation). This should work fine (and it does without heavy load. I am not even able to reproduce the error. Sometimes it happens, sometimes it doesn't happen)
2.) Implementing a connection pool.
What do you think ? -
7. Re: org.jboss.mq.SpyJMSException: OutOfMemoryError
disrael Apr 20, 2005 5:09 PM (in response to regenwetter)We were doing 1) but it is very expensive. I am switching over to 2) which is easy until you play around with server disconnect problem.
-
8. Re: org.jboss.mq.SpyJMSException: OutOfMemoryError
regenwetter Apr 21, 2005 3:44 AM (in response to regenwetter)I thought it is expensitive too until I measured the time. After getting the connection the first time it always takes just 1-2 ms (at maximum 15 ms). It seems the ConnectionFactory is caching the connection. In my opinion everything should work fine if they wouldn't be that strange error I reported.
I'm not pretty sure what do mean with "play around with server disconnect problem" ? Therefore I would like to ask you what is your advice ? -
9. Re: org.jboss.mq.SpyJMSException: OutOfMemoryError
felderr Oct 6, 2005 10:46 AM (in response to regenwetter)Did you already solved the problem? We get the same error, but in combination with an OutOfMemoryError:
Caused by: org.jboss.mq.SpyJMSException: Cannot get a client ID; - nested throwable: (java.lang.reflect.UndeclaredThrowableException)
at org.jboss.mq.Connection.askForAnID(Connection.java:1119)
at org.jboss.mq.Connection.checkClientID(Connection.java:1092)
at org.jboss.mq.SpyConnection.createQueueSession(SpyConnection.java:175)
at at.sozvers.eweko.service.impl.DomeaJMSClientServiceImpl.createQueueSession(DomeaJMSClientServiceImpl.java:69)
at at.sozvers.eweko.service.impl.DomeaJMSClientServiceImpl.forwardDoc(DomeaJMSClientServiceImpl.java:113)
... 73 more
Caused by: java.lang.reflect.UndeclaredThrowableException
at org.jboss.mq.il.uil2.msgs.BaseMsg.setError(BaseMsg.java:301)
at org.jboss.mq.il.uil2.SocketManager$ReadTask.replyAll(SocketManager.java:445)
at org.jboss.mq.il.uil2.SocketManager$ReadTask.handleStop(SocketManager.java:399)
at org.jboss.mq.il.uil2.SocketManager$ReadTask.run(SocketManager.java:344)
... 1 more
Caused by: java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start(Native Method)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor.addThread(PooledExecutor.java:520)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor.execute(PooledExecutor.java:880)
at org.jboss.mq.il.uil2.SocketManager$ReadTask.run(SocketManager.java:298)
... 1 more
Any Idea? -
11. Re: org.jboss.mq.SpyJMSException: OutOfMemoryError
huonghovan Oct 14, 2005 1:10 PM (in response to regenwetter)Hi all,
I got the same problem with you guys if i just close only the Session. But after i do the close for all include the Sender and Connection it looks OK. I was ran out of Memory after 1000 message post to the queue. Here is what i do with my sendObject:
public static void sendObject(Serializable object, String jvmURL, String queueName)
throws NamingException, JMSException {
PSServiceLocator locator = new PSServiceLocator(jvmURL);
//lookup the resources
QueueConnectionFactory connectionFactory =
(QueueConnectionFactory)locator.lookupObject(CONNECTION_FACTORY);
Queue queue = (Queue)locator.lookupObject(queueName);
//safe jms resources
QueueConnection queueConnection = null;
QueueSession queueSession = null;
QueueSender queueSender = null;
try {
//create the session connection
queueConnection = connectionFactory.createQueueConnection();
//instance the queue session
queueSession = queueConnection.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);
//create queue and send the message
queueSender = queueSession.createSender(queue);
Message message = queueSession.createObjectMessage(object);
queueSender.send(message);
}finally {
//free all created objects
if(queueSender != null) {
queueSender.close();
}
if(queueSession != null) {
queueSession.close();
}
if(queueConnection != null) {
queueConnection.close();
}
}
}
Hope it helps you all, -
12. Re: org.jboss.mq.SpyJMSException: OutOfMemoryError
alchemista Dec 4, 2006 8:35 AM (in response to regenwetter)I use my JMS client as an appender for log4j. In log4j, since append is called very frequently, it's not recommended to close the sender/session/connection each time.
Apache's log4j JMS Appender does not close the publisher/session/connection with each log send. The doAppend method is synchronized luckily :)