[ openjms-Bugs-1214292 ] topicSubscriber.close() hangs
"SourceForge.net" <[email protected]> Fri, 10 Jun 2005 03:37:56 -0700
| Newsgroups | gmane.comp.java.openjms.devel |
|---|---|
| Message-ID | <[email protected]> |
Bugs item #1214292, was opened at 2005-06-03 14:13 Message generated for change (Comment added) made by russellperry You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=474136&aid=1214292&group_id=54559 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: ssp (surjitinlondon) Assigned to: Nobody/Anonymous (nobody) Summary: topicSubscriber.close() hangs Initial Comment: Hi We have cleanup code as shown below : topicConnection.stop(); topicSubscriber.close(); <-- hangs here topicSession.close(); topicConnection.close(); which ocassionaly hangs when executing topicSubscriber.close(); Any ideas ? Thanks ---------------------------------------------------------------------- Comment By: Russ (russellperry) Date: 2005-06-10 10:37 Message: Logged In: YES user_id=1294329 I get this hang whenever I call topicSubscriebr.close() in the way shown above. I'm using version 0.7.6.1. This occurs whenever the Subscriber is trying to close() at the same time that a message is being delivered by one of the JMS RMI Threads. Looking at the code it seems to be possible for a deadlock to occur (possibly in multiple ways). This is because both the close () and onMessage(~) methods on the TopicSubscriber use synchronized and also the TopicSession uses synchronized on the methods removeSubscriber(~) and execute(~). I think what's happening is the close() method gets called by the application thread, which internally calls removeSubscriber() on the TopicSession. This grabs the TopicSession Lock as well as the TopicSubscriber Locks. At the same time, a JMS RMI thread tries to deliver a message. This blocks on the TopicSession execute() method because it can't get the TopicSession lock. It seems the application thread eventually blocks on the RemoteJmsServerSessionIfc.deleteSubscriber(long) call. I think this is because a message delivery is in progress? I think , there are other combinations of dealock that occur. For example if close() is called by the app thread (grabs TopicSubscriber Lock). A JMS-RMI thread inside the TopicSession execute(~) method blocks trying to deliver a message to the consumer using onMessage(~); it can't get the TopicSubscriber lock. The app thread also blocks when calling removeSubscriber(~) because it can' the TopicSession lock currently held by the JMS RMI Thread. Hope this helps. ---------------------------------------------------------------------- Comment By: Tim Anderson (tanderson) Date: 2005-06-08 04:58 Message: Logged In: YES user_id=557161 Can you attach a client and server stack trace? See http://openjms.sourceforge.net/faq.html if you don't now how to generate these. Also update the group field to include the openjms version you are using. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=474136&aid=1214292&group_id=54559 ------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput a projector? How fast can you ride your desk chair down the office luge track? If you want to score the big prize, get to know the little guy. Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20