Bugzilla – Attachment 53071 Details for
Bug 15419
Sipserver problem with stale db handles
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15419 SIP: call auth() subs with timeout, and refresh dbh if need be
Bug-15419-SIP-call-auth-subs-with-timeout-and-refr.patch (text/plain), 2.14 KB, created by
Srdjan Jankovic
on 2016-07-04 05:16:56 UTC
(
hide
)
Description:
Bug 15419 SIP: call auth() subs with timeout, and refresh dbh if need be
Filename:
MIME Type:
Creator:
Srdjan Jankovic
Created:
2016-07-04 05:16:56 UTC
Size:
2.14 KB
patch
obsolete
>From 90b9c37996a3707e00a1b23d4d82694f22212da6 Mon Sep 17 00:00:00 2001 >From: Srdjan <srdjan@catalyst.net.nz> >Date: Mon, 4 Jul 2016 17:08:39 +1200 >Subject: [PATCH] Bug 15419 SIP: call auth() subs with timeout, and refresh dbh > if need be > >--- > C4/SIP/ILS/Patron.pm | 11 +++++++++-- > C4/SIP/Sip/MsgType.pm | 11 ++++++++++- > 2 files changed, 19 insertions(+), 3 deletions(-) > >diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm >index 93b6c54..c3d348d 100644 >--- a/C4/SIP/ILS/Patron.pm >+++ b/C4/SIP/ILS/Patron.pm >@@ -14,6 +14,7 @@ use Carp; > > use Sys::Syslog qw(syslog); > use Data::Dumper; >+use Time::Out qw(timeout); > > use C4::Debug; > use C4::Context; >@@ -199,9 +200,15 @@ sub check_password { > # If the record has a NULL password, accept '' as match > return $pwd eq q{} unless $self->{password}; > >- my $dbh = C4::Context->dbh; > my $ret = 0; >- ($ret) = checkpw( $dbh, $self->{userid}, $pwd, undef, undef, 1 ); # dbh, userid, query, type, no_set_userenv >+ local $@; >+ ($ret) = timeout (5 => sub { >+ # dbh, userid, query, type, no_set_userenv >+ checkpw( C4::Context->dbh, $self->{userid}, $pwd, undef, undef, 1 ); >+ }); >+ if ($@) { >+ ($ret) = checkpw( C4::Context->new_dbh, $self->{userid}, $pwd, undef, undef, 1 ); >+ } > return $ret; > } > >diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm >index 787449b..e8a4669 100644 >--- a/C4/SIP/Sip/MsgType.pm >+++ b/C4/SIP/Sip/MsgType.pm >@@ -10,6 +10,7 @@ use strict; > use warnings; > use Exporter; > use Sys::Syslog qw(syslog); >+use Time::Out qw(timeout); > > use C4::SIP::Sip qw(:all); > use C4::SIP::Sip::Constants qw(:all); >@@ -1607,7 +1608,15 @@ sub api_auth { > if ($branch) { > $query->param( branch => $branch ); > } >- my ( $status, $cookie, $sessionID ) = check_api_auth( $query, { circulate => 1 }, 'intranet' ); >+ >+ local $@; >+ my ( $status, $cookie, $sessionID ) = timeout (5 => sub { >+ check_api_auth( $query, { circulate => 1 }, 'intranet' ); >+ }); >+ if ($@) { >+ C4::Context->new_dbh; >+ ( $status, $cookie, $sessionID ) = check_api_auth( $query, { circulate => 1 }, 'intranet' ); >+ } > return $status; > } > >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15419
:
53071
|
55273
|
57871