Bugs item #620514, was opened at 2002-10-08 23:18 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376685&aid=620514&group_id=22866
Category: JBossMQ Group: v3.0 Rabbit Hole >Status: Closed Resolution: Fixed Priority: 9 Submitted By: Steve Wolfangel (swolfangel) Assigned to: Adrian Brock (ejort) Summary: MQ OutOfMemoryException Initial Comment: I am getting the following exception when running a test that continously publishes messages. JMSTest.java is included. org.jboss.mq.SpyJMSException: Cannot send a message to the JMS server; - nested throwable: (java.rmi .ServerError: Error occurred in server thread; nested exception is: java.lang.OutOfMemoryError) at org.jboss.mq.Connection.sendToServer (Connection.java:1127) at org.jboss.mq.SpySession.sendMessage (SpySession.java:562) at org.jboss.mq.SpyTopicPublisher.internalPublish (SpyTopicPublisher.java:120) at org.jboss.mq.SpyTopicPublisher.publish (SpyTopicPublisher.java:68) at JMSTest.main(JMSTest.java:121) + nested throwable: java.rmi.ServerError: Error occurred in server thread; nested exception is: java.lang.OutOfMemoryError java.lang.OutOfMemoryError at sun.rmi.transport.StreamRemoteCall.exceptionRecei vedFromServer(StreamRemoteCall.java:245) at sun.rmi.transport.StreamRemoteCall.executeCall (StreamRemoteCall.java:220) at sun.rmi.server.UnicastRef.invoke (UnicastRef.java:122) at org.jboss.mq.il.rmi.RMIServerIL_Stub.addMessage (Unknown Source) at org.jboss.mq.Connection.sendToServer (Connection.java:1119) at org.jboss.mq.SpySession.sendMessage (SpySession.java:562) at org.jboss.mq.SpyTopicPublisher.internalPublish (SpyTopicPublisher.java:120) at org.jboss.mq.SpyTopicPublisher.publish (SpyTopicPublisher.java:68) at JMSTest.main(JMSTest.java:121) 17:20:58,683 INFO [Server] JBoss Release: JBoss- 3.0.3 CVSTag=JBoss_3_0_3 17:20:58,730 INFO [Server] Home Dir: E:\cvs\jboss-3.0.3-src\build\output\jboss-3 .0.3 17:20:58,730 INFO [Server] Home URL: file:/E:/cvs/jboss-3.0.3-src/build/output/j boss-3.0.3/ 17:20:58,730 INFO [Server] Library URL: file:/E:/cvs/jboss-3.0.3-src/build/outpu t/jboss-3.0.3/lib/ 17:20:58,745 INFO [Server] Patch URL: null 17:20:58,745 INFO [Server] Server Name: default 17:20:58,745 INFO [Server] Server Home Dir: E:\cvs\jboss-3.0.3-src\build\output\ jboss-3.0.3\server\default 17:20:58,745 INFO [Server] Server Home URL: file:/E:/cvs/jboss-3.0.3-src/build/o utput/jboss-3.0.3/server/default/ 17:20:58,745 INFO [Server] Server Data Dir: E:\cvs\jboss-3.0.3-src\build\output\ jboss-3.0.3\server\default\db 17:20:58,745 INFO [Server] Server Temp Dir: E:\cvs\jboss-3.0.3-src\build\output\ jboss-3.0.3\server\default\tmp 17:20:58,745 INFO [Server] Server Config URL: file:/E:/cvs/jboss-3.0.3-src/build /output/jboss-3.0.3/server/default/conf/ 17:20:58,745 INFO [Server] Server Library URL: file:/E:/cvs/jboss-3.0.3-src/buil d/output/jboss-3.0.3/server/default/lib/ 17:20:58,745 INFO [Server] Root Deployemnt Filename: jboss-service.xml 17:20:58,776 INFO [Server] Starting General Purpose Architecture (GPA)... 17:20:59,198 INFO [ServerInfo] Java version: 1.3.1_01,Sun Microsystems Inc. 17:20:59,198 INFO [ServerInfo] Java VM: Java HotSpot(TM) Client VM 1.3.1_01,Sun Microsystems Inc. 17:20:59,198 INFO [ServerInfo] OS-System: Windows NT 4.0,x86 ---------------------------------------------------------------------- Comment By: Adrian Brock (ejort) Date: 2002-10-29 23:03 Message: Logged In: YES user_id=9459 Fixed for 3.0.4 1) The message is removed from the cache, and perisistent storage when it does not match the subscription's selector. 2) When the client drops the connection, or fails to acknowledge a message, the unacknowledged messages are nacked. This fixes two problems: a) The cached messages are removed when the suscription ends and the queue isn't persistent. b) The unacked messages are available again for persistent queues without having to restart the server. Regards, Adrian ---------------------------------------------------------------------- Comment By: Steve Wolfangel (swolfangel) Date: 2002-10-18 21:29 Message: Logged In: YES user_id=541224 Ok there seem to be 2 problems here. 1) When noLocal is set to true and the client subscribes to a publishes to the same topic, the message never gets removed from the messageCache. I changed some code in JMSTopic to get around this problem. I added a check in the addMessage method before adding the message to the queue and the MessageCache. Not sure if this is the correct approach but it seems to work. (code at bottom) 2) If a subscriber connection is broken (not closed gracefully) by ^C-ing then the messages can't be sent to the subscriber, these messages are never removed from the MessageCache. Any help would be greatly appreciated. JMSTopic.java public void addMessage(SpyMessage message, org.jboss.mq.pm.Tx txId) throws JMSException { // if( message.getJMSDeliveryMode() == DeliveryMode.PERSISTENT && // temporaryDestination! =null ) { // throw new JMSException ("Cannot write a persistent message to a temporary destination!"); // } //Number the message so that we can preserve order of delivery. long messageId = 0; synchronized (this) { messageId = messageIdCounter++; synchronized (durQueues) { Iterator iter = durQueues.keySet().iterator(); while (iter.hasNext()) { DurableSubscriptionID id = (DurableSubscriptionID) iter.next(); PersistentQueue q = (PersistentQueue) durQueues.get(id); SpyMessage clone = message.myClone(); clone.header.durableSubscriberID = id; clone.header.messageId = messageId; //new stuff if (q.exclusiveSubscription.accepts (clone.header)) { MessageReference ref = server.getMessageCache().add(clone); q.addMessage(ref, txId); } } } synchronized (tempQueues) { Iterator iter = tempQueues.values().iterator(); while (iter.hasNext()) { BasicQueue q = (BasicQueue) iter.next(); SpyMessage clone = message.myClone(); clone.header.messageId = messageId; // new stuff if (q.exclusiveSubscription.accepts (clone.header)) { MessageReference ref = server.getMessageCache().add(clone); q.addMessage(ref, txId); } } } } } ---------------------------------------------------------------------- Comment By: Roger Stevens (pinseeker) Date: 2002-10-18 09:01 Message: Logged In: YES user_id=631489 In Subscription.java accepts method at line 71 the following code appears < if (noLocal ) { if( header.producerClientId.equals(connectionToken.getClientID())) return false; } > In Subscription.java ConnectionToken never gets initialised and hence never returns false and hence messages are accepted. ---------------------------------------------------------------------- Comment By: Steve Wolfangel (swolfangel) Date: 2002-10-17 20:18 Message: Logged In: YES user_id=541224 New information: The cache problem occurs when the same client subscribes and publishes to the same topic, regardless of the noLocal flag. ---------------------------------------------------------------------- Comment By: Steve Wolfangel (swolfangel) Date: 2002-10-17 19:37 Message: Logged In: YES user_id=541224 After much more testing it appears the problem has something to do with the noLocal flag in the createSubscriber() method. When I set noLocal to true I see the MessageCache continue to grow. When I set noLocal to false then the MessageCache works as expected messages get added and removed. TopicSubscriber subscriber = session.createSubscriber (topic, null, true); // cache continues to grow TopicSubscriber subscriber = session.createSubscriber (topic, null, false); // cache works correctly ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376685&aid=620514&group_id=22866 ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development