Hi Rick,

For bug:

3137873 rxapi looping

You applied r6571 to trunk, which you were 99% sure fixed the problem.
 Rainer built a 64-bit test build for Henning and eventually Henning
said it fixed the problem for him on his 64 bit systems.

Do you think it is okay for me to back port that commit to the 4.1 bug
fixes branch?

The commit diff looks like this:

Modified Paths:
--------------
    main/trunk/rexxapi/server/QueueManager.cpp
    main/trunk/rexxapi/server/QueueManager.hpp

Modified: main/trunk/rexxapi/server/QueueManager.cpp
===================================================================
--- main/trunk/rexxapi/server/QueueManager.cpp  2011-01-10 06:07:59
UTC (rev 6570)
+++ main/trunk/rexxapi/server/QueueManager.cpp  2011-01-11 14:10:18
UTC (rev 6571)
@@ -306,8 +306,22 @@
 }

 /**
- * locate a named data queue
+ * locate a named data queue, with session manager locking
  *
+ * @param name   The target data queue name.
+ *
+ * @return The DataQueue descriptor, or NULL if it does not
+ *         exist.
+ */
+DataQueue *QueueTable::synchronizedLocate(ServerQueueManager
*manager, const char *name)
+{
+    Lock managerLock(manager->lock);   // this needs synchronization here
+    return locate(name);
+}
+
+/**
+ * locate a session data queue
+ *
  * @param id     The session ID of the queue.
  *
  * @return The DataQueue for the session, which will be created
@@ -333,7 +347,21 @@
     return NULL;                    // return NULL if not located
 }

+/**
+ * locate a session data queue, with session manager locking
+ *
+ * @param id     The session ID of the queue.
+ *
+ * @return The DataQueue for the session, which will be created
+ *         if needed.
+ */
+DataQueue *QueueTable::synchronizedLocate(ServerQueueManager
*manager, SessionID id)
+{
+    Lock managerLock(manager->lock);   // this needs synchronization here
+    return locate(id);
+}

+
 /**
  * locate and remove a named data queue
  *
@@ -484,7 +512,11 @@
 // nameArg    -- ASCII-Z name of the queue
 void ServerQueueManager::pullFromNamedQueue(ServiceMessage &message)
 {
-    DataQueue *queue = namedQueues.locate(message.nameArg);
+    // we're holding the lock yet, so we need to use the locate
+    // method that grabs the lock first.  If we don't, then we run
+    // the risk that the queue will be reordered while we're searching.
+    // The results will be bad, definitely very bad.
+    DataQueue *queue = namedQueues.synchronizedLocate(this, message.nameArg);
     // not previously created?
     if (queue == NULL)
     {
@@ -503,6 +535,10 @@
 // parameter1 -- caller's session id (replaced by queue handle on return);
 DataQueue *ServerQueueManager::getSessionQueue(SessionID session)
 {
+    // this could be redundant, but if called as a result of a PULL operation,
+    // we're not holding the lock yet.  We need to nest the call.
+    Lock managerLock(lock);
+
     DataQueue *queue = sessionQueues.locate(session);
     // not previously created?
     if (queue == NULL)

Modified: main/trunk/rexxapi/server/QueueManager.hpp
===================================================================
--- main/trunk/rexxapi/server/QueueManager.hpp  2011-01-10 06:07:59
UTC (rev 6570)
+++ main/trunk/rexxapi/server/QueueManager.hpp  2011-01-11 14:10:18
UTC (rev 6571)
@@ -199,7 +199,11 @@
     // locate a named data queue
     DataQueue *locate(const char *name);
     // locate a named data queue
+    DataQueue *synchronizedLocate(ServerQueueManager *manager, const
char *name);
+    // locate a session data queue
     DataQueue *locate(SessionID id);
+    // locate a session data queue
+    DataQueue *synchronizedLocate(ServerQueueManager *manager, SessionID id);
     // locate and remove a named data queue
     DataQueue *remove(const char *name);
     // locate a named data queue
@@ -246,6 +250,7 @@
 class ServerQueueManager
 {
     friend class DataQueue;     // needs access to the instance lock
+    friend class QueueTable;    // needs access to the instance lock
 public:
     ServerQueueManager() : namedQueues(), sessionQueues(), lock() {
lock.create(); }

--
Mark Miesfeld

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to