Stop waiting for method response when browser disconnects

Bug #1616501 reported by Mike Rylander
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Evergreen
Confirmed
Medium
Unassigned
OpenSRF
Fix Released
Wishlist
Unassigned

Bug Description

When inside mod_perl, and the client disconnects, we should stop trying to receive results from a request. This will help prevent apache backend pile-ups when a cat sits on the Enter key at an OPAC computer.

Branch at: http://git.evergreen-ils.org/?p=working/OpenSRF.git;a=shortlog;h=refs/heads/user/miker/give-up-at-browser_stop

Revision history for this message
Mike Rylander (mrylander) wrote :
Changed in evergreen:
milestone: none → 2.next
Revision history for this message
Galen Charlton (gmc) wrote :

Using %ENV to pass the request object around won't work for Perl 5.18 and later, as stuff assigned to %ENV gets immediately stringified:

http://perldoc.perl.org/perlvar.html#%25ENV

It worked prior to 5.18 because the stringification used to happen only when passing the environment to child processes.

An alternative would be ensuring that +GlobalRequest is turned on for /eg, which in turn would allow use of Apache2::RequestUtil->request (although per bug 1579219 I at least would prefer that the check be wrapped well enough so that mod_perl remains an optional dependency for OpenSRF :) )

Removing pullrequest for now.

tags: removed: pullrequest
Revision history for this message
Mike Rylander (mrylander) wrote :

Ah! Thanks, modern perl.

In that case, I think it's simplest (both in code and in administrator effort) to use an OpenSRF.pm package-local variable wrapped in an API to accept a request-looking object, rather than requiring OpenSRF to include Apache2::RequestUtil. We just got rid of mod_perl as a dep ... :)

Thoughts on that alternative?

Revision history for this message
Mike Rylander (mrylander) wrote :

I've updated the two branches linked above to make that happen. Note that using an API means that Evergreen requires a supporting OpenSRF, instead of silently degrading to the old behavior as setting ENV (or another variable) would allow.

Galen Charlton (gmc)
tags: added: pullrequest
Galen Charlton (gmc)
Changed in opensrf:
milestone: 2.5-alpha → 2.5-beta
Revision history for this message
Galen Charlton (gmc) wrote :

I've pushed the (squashed) patches to OpenSRF for inclusion in 2.5-beta. Thanks, Mike! I'll continue testing the Evergreen side as a potential candidate bugfix for Evergreen 2.12-rc.

Changed in opensrf:
status: New → Fix Committed
Galen Charlton (gmc)
Changed in opensrf:
status: Fix Committed → Fix Released
Dan Wells (dbw2)
Changed in evergreen:
milestone: 3.next → 3.1-beta
Dan Wells (dbw2)
Changed in evergreen:
status: New → Confirmed
importance: Undecided → Medium
Changed in evergreen:
milestone: 3.1-beta → 3.1-rc
Changed in evergreen:
milestone: 3.1-rc → 3.1.1
Changed in evergreen:
milestone: 3.1.1 → 3.1.2
Changed in evergreen:
milestone: 3.1.2 → 3.1.3
Changed in evergreen:
milestone: 3.1.3 → 3.1.4
Changed in evergreen:
milestone: 3.1.4 → 3.1.5
Changed in evergreen:
milestone: 3.1.5 → 3.1.6
Changed in evergreen:
milestone: 3.1.6 → 3.2.1
milestone: 3.2.1 → 3.1.7
Revision history for this message
Evergreen Bug Maintenance (bugmaster) wrote :

Bumping to 3.2.2 so it is not lost there. It should be backported to Evergreen 3.1. also, but since this is an OpenSRF bug, we can apparently only target 1 Evergreen milestone in the Evergreen portion.

Changed in evergreen:
milestone: 3.1.7 → 3.1.8
milestone: 3.1.8 → 3.2.2
Revision history for this message
Chris Sharp (chrissharp123) wrote :

Seeing this error when doing a bib search after applying this patch over current Evergreen master on OpenSRF master:

2018-11-06 11:00:22 csharp-master-xenial gateway: [ERR :28889:Search.pm:466:15415199542888913] multiclass search error: Can't locate object method "aborted" via package "Apache2::Connection" at /usr/local/share/perl/5.22.1/OpenSRF/Transport/SlimJabber/XMPPReader.pm line 228.
2018-11-06 11:00:42 csharp-master-xenial gateway: [perl:error] [pid 28892] [client ::1:58072] egweb: Context Loader error: Can't locate object method "aborted" via package "Apache2::Connection" at /usr/local/share/perl/5.22.1/OpenSRF/Transport/SlimJabber/XMPPReader.pm line 228.\n, referer: https://csharp-master.gapines.org/eg/opac/results?query=sd&qtype=keyword&fi%3Asearch_format=&locg=1&detail_record_view=0&_adv=1&sort=

Changed in evergreen:
milestone: 3.2.2 → 3.2.3
Changed in evergreen:
milestone: 3.2.3 → 3.2.4
Changed in evergreen:
milestone: 3.2.4 → 3.2.5
Changed in evergreen:
milestone: 3.2.5 → 3.2.6
Changed in evergreen:
milestone: 3.2.6 → 3.2.7
Revision history for this message
Mike Rylander (mrylander) wrote :

Chris,

Based on the error message, it looks like you're using a mod_perl from the 1.x series, which doesn't have an aborted() method in Apache2::Connection. Looks like that showed up with version 2.0.0. Can you confirm your Apache2 (perl module) and mod_perl versions?

Thanks!

Revision history for this message
Chris Sharp (chrissharp123) wrote :

Well, after installing your commits atop Evergreen master running on OpenSRF master on Ubuntu 16.04 (Apache 2.4.18/mod_perl version 2.0.9), I'm not seeing the errors. I don't know what was different back in November when I tested before, but I don't see a problem with this so far in my testing. I'll poke it some more and sign off as soon as I'm satisfied that everything looks fine.

Changed in evergreen:
assignee: nobody → Chris Sharp (chrissharp123)
Changed in evergreen:
assignee: Chris Sharp (chrissharp123) → nobody
Changed in evergreen:
milestone: 3.2.7 → 3.3.3
Changed in evergreen:
milestone: 3.3.3 → 3.3.4
Changed in evergreen:
milestone: 3.3.4 → 3.3.5
Changed in evergreen:
milestone: 3.3.5 → 3.4.2
Changed in evergreen:
milestone: 3.4.2 → 3.4.3
Changed in evergreen:
milestone: 3.4.3 → 3.4.4
Changed in evergreen:
milestone: 3.4.4 → 3.5.1
Changed in evergreen:
milestone: 3.5.1 → 3.5.2
Changed in evergreen:
milestone: 3.5.2 → 3.6.1
Changed in evergreen:
milestone: 3.6.1 → 3.6.2
Changed in evergreen:
milestone: 3.6.2 → 3.6.3
Changed in evergreen:
milestone: 3.6.3 → 3.6.4
Changed in evergreen:
milestone: 3.6.4 → 3.7.2
no longer affects: evergreen/3.1
no longer affects: evergreen/3.2
no longer affects: evergreen/3.3
no longer affects: evergreen/3.4
no longer affects: evergreen/3.5
Changed in evergreen:
milestone: 3.7.2 → 3.7.3
Changed in evergreen:
milestone: 3.7.3 → none
Changed in opensrf:
milestone: 2.5-beta → none
Revision history for this message
Blake GH (bmagic) wrote :

I attempted to merge this onto 3.9.0. It seems that this patch is already merged? With the small change of

$ENV renamed to: OpenSRF

?

Revision history for this message
Jason Boyer (jboyer) wrote :

Hi Mike, I was testing this today and nothing I could do would trigger the "Upstream Apache client disconnected, aborting." log message, only the apache broken pipe message that normally appears when a client goes away. I tried searching for 'test' and just holding down Enter, along with searching for just 'a' the same way.

Revision history for this message
Mike Rylander (mrylander) wrote :

Thanks for testing, Jason!

I wonder if having nginx in the middle is impacting the ability of apache to see when the client went away. I'll look into that a bit.

Revision history for this message
Bill Erickson (berick) wrote :

Removing pullrequest tag pending resolution to previous comment.

tags: removed: pullrequest
tags: added: performance
tags: added: needswork
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.