[OpenSRF-GIT] OpenSRF branch master updated. 78f15b09801f508a8db3b03cf40ab73c6d6b144d

Evergreen Git git at git.evergreen-ils.org
Mon Mar 18 17:18:23 EDT 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "OpenSRF".

The branch, master has been updated
       via  78f15b09801f508a8db3b03cf40ab73c6d6b144d (commit)
      from  c8b808c739637ec68f2d8181f73d93f880f55dd6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 78f15b09801f508a8db3b03cf40ab73c6d6b144d
Author: Bill Erickson <berick at esilibrary.com>
Date:   Fri Mar 15 15:56:55 2013 -0400

    Multisession blocking repair
    
    The new socket blocking code for multisession failed to take into
    account that socket activity outside of the main block could lead to a
    deadlock situation.  For example:
    
    * Check status of request A -> not complete
    * Check status of request B -> whatever
    * Request A may now be complete, since checking the status of any request
      affects all requests
    * Return to blocking loop because we think there is pending data, but in
      fact all data has already been pulled from the socket.
    
    The solution is for session_reap() to make a sweep and check for changes
    in requests that are now complete as a side-effect of checking for
    completed requests.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/src/perl/lib/OpenSRF/MultiSession.pm b/src/perl/lib/OpenSRF/MultiSession.pm
index e196027..4b9a996 100644
--- a/src/perl/lib/OpenSRF/MultiSession.pm
+++ b/src/perl/lib/OpenSRF/MultiSession.pm
@@ -236,6 +236,20 @@ sub session_wait {
 }
 
 sub session_reap {
+    my $self = shift;
+    $self->_session_reap;
+
+    # if any requests are marked complete as a side effect of 
+    # _session_reap, re-run _session_reap.  note that we check
+    # for completeness without touching the underlying socket
+    # (req->{complete} vs req->complete) to avoid additional 
+    # unintended socket-touching side effects.
+    while (grep { $_->{req}->{complete} } @{$self->{running}}) {
+        $self->_session_reap;
+    }
+}
+
+sub _session_reap {
 	my $self = shift;
 
 	my @done;

-----------------------------------------------------------------------

Summary of changes:
 src/perl/lib/OpenSRF/MultiSession.pm |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
OpenSRF


More information about the opensrf-commits mailing list