[Rt-commit] rt branch, 4.4/fix-oracle-session-hanging-issue, created. rt-4.4.3-197-g26ac17669

? sunnavy sunnavy at bestpractical.com
Tue Jan 22 15:34:05 EST 2019


The branch, 4.4/fix-oracle-session-hanging-issue has been created
        at  26ac1766981da33e50cf9f6f41b1ef3f5092ec2c (commit)

- Log -----------------------------------------------------------------
commit 57698628f8f0cad8f1fc6f020688be5b2fb2c89a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Jan 23 04:19:08 2019 +0800

    Get around the hanging issue of Oracle sessions
    
    The guts are not 100% clear yet, but forcely updating %session(i.e.  to
    unlock the db row by a SQL commit) could fix this hanging issue.

diff --git a/lib/RT/Interface/Web/Session.pm b/lib/RT/Interface/Web/Session.pm
index 3ee4cc680..69ff5d874 100644
--- a/lib/RT/Interface/Web/Session.pm
+++ b/lib/RT/Interface/Web/Session.pm
@@ -333,6 +333,18 @@ sub TIEHASH {
           . "This may mean that that the directory '$RT::MasonSessionDir' isn't writable or a database table is missing or corrupt.\n\n"
           . $@;
     }
+    elsif ( RT->Config->Get('DatabaseType') eq 'Oracle' ) {
+
+        # Apache::Session::Store::Oracle locks the row using the SQL:
+        # "SELECT a_session FROM $self->{'table_name'} WHERE id = ? FOR UPDATE".
+        #
+        # Subsequent requests(tie) will wait until the lock is freed by
+        # a commit(by updating %session) or until the db connection that
+        # created the lock is closed. To avoid this hanging issue, we
+        # forcely update %session here to make sure there is a commit.
+
+        $session{'i'}++;
+    }
 
     return tied %session;
 }

commit 26ac1766981da33e50cf9f6f41b1ef3f5092ec2c
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Jan 23 04:25:03 2019 +0800

    Test Oracle session as the hanging issue is gone

diff --git a/t/web/session.t b/t/web/session.t
index b7b7d1dfd..3ec8e8ddb 100644
--- a/t/web/session.t
+++ b/t/web/session.t
@@ -6,13 +6,6 @@ use RT::Test tests => undef;
 
 plan skip_all => 'SQLite has shared file sessions' if RT->Config->Get('DatabaseType') eq 'SQLite';
 
-# Web server hangs when processing the same session row after tied
-# %session on Oracle with non-inline web servers :/
-# Use file session instead for now.
-if ( RT->Config->Get('DatabaseType') eq 'Oracle' && ( $ENV{'RT_TEST_WEB_HANDLER'} || '' ) ne 'inline' ) {
-    RT->Config->Set( 'WebSessionClass', 'Apache::Session::File' );
-}
-
 my ($baseurl, $agent) = RT::Test->started_ok;
 my $url = $agent->rt_base_url;
 

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


More information about the rt-commit mailing list