Creates an API-level option to inform the OpenSRF drone management code
that the running drone should be recycled upon completion of the current
OpenSRF session. This allows for quicker release of resources consumed
by the drone.
To use:
sub some_api_method {
my ($self, $client, ...) = @_;
$self->session->force_recycle(1);
...
}
Signed-off-by: Bill Erickson <berickxx@gmail.com> Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Bill Erickson [Mon, 27 Aug 2018 14:12:57 +0000 (10:12 -0400)]
LP#1684970 Translator compatible with mod_remoteip
Teach the OSRF Translator to request the IP address of the user agent
(e.g. web browser) instead of the IP address of the up stream client,
which may be a proxy, using the Apache 2.4 request_rec->useragent_ip
value.
* Adds security recommendations from
https://mozilla.github.io/server-side-tls/ssl-config-generator/
* Enables http2
* Apply a 5-minute proxy read timeout to avoid too-short timeouts on
long API calls.
* Adds a (commented) section on sending nginx logs to syslog
Includes INSTALL notes on generating the dhparam file.
Signed-off-by: Bill Erickson <berickxx@gmail.com> Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Teach the websocket client code to look for the transport_error flag
applied to the websocket wrapper message by the websocket gateway when a
request for an unavilable service is made.
When encountered, fire the transport or generic error handler callbacks,
if available. Avoid any attempts to further process the message.
Signed-off-by: Bill Erickson <berickxx@gmail.com> Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
* Message template typo repair -- missing "'"
* XPath repair on path to opensrf sub-element for Perl
* Move 'type' attribute get/set back up to the <message> for Perl.
* Clean up code duplication in the C message building libs.
* Squash a centuries-old memory leak where xmlFree(sender) was only
called if a router_from was not supplied.
Signed-off-by: Bill Erickson <berickxx@gmail.com> Signed-off-by: Jason Stephenson <jason@sigio.com> Signed-off-by: Mike Rylander <mrylander@gmail.com>
Modern versions of Ejabberd strip custom XML attributes which appear
outside of custom elements. To support OpenSRF's custom router and
osrf_xid commands, move these attributes into a new custom XML element
<opensrf>.
Signed-off-by: Mike Rylander <mrylander@gmail.com> Signed-off-by: Bill Erickson <berickxx@gmail.com> Signed-off-by: Jason Stephenson <jason@sigio.com>
Adds a new OpenSRF binary/program for relaying websockets messages
to and from a websocketd instance. The new binary
(osrf-websocket-stdio) performs the same tasks as the
osrf_websocket_translator.c Apache module, minus the Apache module glue
and the extra threading required to run within the Apache module.
Commit includes 2 test scripts (tester.pl and test-stateful.pl) for
generating large series of test messages to send to a websockets
instance. tester.pl sends echo requests only, test-stateful.pl sends
connect->echo-request->disconnect batches across a configurable number
of forked processes.
INSTALL document updated to include websocketd setup as an alternative
to Apache websockets.
Signed-off-by: Bill Erickson <berickxx@gmail.com> Signed-off-by: Jeff Davis <jeff.davis@bc.libraries.coop> Signed-off-by: Jason Stephenson <jason@sigio.com> Signed-off-by: Ben Shum <ben@evergreener.net>
Mike Rylander [Fri, 7 Jul 2017 19:22:21 +0000 (15:22 -0400)]
LP#1702978: memcache Get methods use key as va_list format
And, when a key (composed of, say, a username or barcode) has a % in it,
bad things happen. We will stop acting as if these are variadic functions
now, and also update Evergreen so that it does not do that either.
TODO: Make these actually non-variadic, but that breaks ABI.
Signed-off-by: Mike Rylander <mrylander@gmail.com> Signed-off-by: Cesar Velez <cesar.velez@equinoxinitiative.org> Signed-off-by: Jason Stephenson <jason@sigio.com>
Galen Charlton [Mon, 7 May 2018 20:03:16 +0000 (16:03 -0400)]
LP#1243841: quiet a misleading indentation warning
Adjusts a spaces-vs-tabs issue to fix the following compilation
warning:
osrf_prefork.c: In function ‘check_children’:
osrf_prefork.c:1067:5: warning: this ‘if’ clause does not
guard... [-Wmisleading-indentation]
if( select_ret <= 0 ) // we're done here
^~
osrf_prefork.c:1072:2: note: ...this statement, but the latter is
misleadingly indented as if it is guarded by the ‘if’
cur_child = forker->first_child;
^~~~~~~~~
LP#1243841 - Quiet additional Make warnings and some code cleanup.
We make the following warnings go away:
osrf_legacy_json.c:607:6: warning: variable ‘fourth_dash’ set but
not used [-Wunused-but-set-variable]
osrf_legacy_json.c:836:5: warning: passing argument 3 of ‘makeNode’
discards ‘const’ qualifier from pointer target type [enabled by
default]
utils.c:133:2: warning: format not a string literal and no format
arguments [-Wformat-security]
We also cleanup the while block nested in a do while block around line
63 of osrf_cache.c to be more readable by adding braces and breaking
it across 3 lines.
Signed-off-by: Jason Stephenson <jason@sigio.com> Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Using advice given here: https://stackoverflow.com/a/13999461, "The
only good (if ugly) way to suppress these is to convert the return
value into something that the compiler agrees that you can ignore."
Signed-off-by: Chris Sharp <csharp@georgialibraries.org> Signed-off-by: Jason Stephenson <jason@sigio.com> Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Chris Sharp [Tue, 19 Sep 2017 22:10:00 +0000 (18:10 -0400)]
LP#1243841 - Wrap truth test using "=" in an extra set of parens.
Referring to https://stackoverflow.com/questions/5476759/compiler-warning-suggest-parentheses-around-assignment-used-as-truth-value,
it is recommended to wrap variable assignments that are used as a truth
test within an extra set of parentheses.
Signed-off-by: Chris Sharp <csharp@georgialibraries.org> Signed-off-by: Jason Stephenson <jason@sigio.com> Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Jason Stephenson [Sun, 18 Feb 2018 17:12:13 +0000 (12:12 -0500)]
LP1340982: Ignore both 'comment' and '#comment' nodes in Settings Parse.
Modify the XML2perl helper function in OpenSRF::Utils::SettingsParser
to ignore comment nodes that have names of comment and #comment.
To reproduce the bug:
1. Stop OpenSRF services.
2. Add a XML comment, any text betwen <!-- and -->, in the list of
MARC templates in the opensrf.xml file.
3. Restart OpenSRF services.
4. In the staff client, go to Cataloging->Create New MARC Record.
5. In the list of templates, you will #comment where you added the
comment. (NOTE: I only tested with 1 comment. Things may get worse
with more than 1 comment.)
6. There will be an error like the following in the
open-ils.cat_stderr.log if you attempt to choose the #comment entry:
Caught error from 'run' method: Exception: OpenSRF::EX::ERROR
2018-02-18T11:24:30 OpenSRF::Application
/usr/local/share/perl/5.22.1/OpenSRF/Application.pm:240 System
ERROR: Unable to open MARC template file: HASH(0x2249928) :
To test the fix:
1. Leave the comments in the opensrf.xml file from before.
2. Apply this commit, do make and make install for OpenSRF.
3. Just to make sure, do make and make install for Evergreen.
4. Repeat steps 3 and 4 from above.
5. You should NOT see any templates named #comment.
Signed-off-by: Jason Stephenson <jason@sigio.com> Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Bill Erickson [Tue, 10 Apr 2018 19:06:56 +0000 (15:06 -0400)]
LP#1762815 Empty client TZ defaults to server TZ (Perl)
Fixes an issue in the Perl client time zone handling that resulted in
the server defaulting to UTC time instead of the server time zone when
no time zone value was received from the client.
Signed-off-by: Bill Erickson <berickxx@gmail.com> Signed-off-by: Jason Stephenson <jason@sigio.com>
Bill Erickson [Wed, 24 Jan 2018 20:16:14 +0000 (15:16 -0500)]
LP#1744158 Websocket proc exits on ejabberd disconnect
Any errors relaying websocket messages to OpenSRF now result in the WS
client being disconnected, allowing the WS process to exit. This
prevents the WS gateway from accepting requests it cannot process and
allows the client to connect to a new WS process.
Signed-off-by: Bill Erickson <berickxx@gmail.com> Signed-off-by: Jason Stephenson <jason@sigio.com>
Bill Erickson [Wed, 31 Jan 2018 18:07:41 +0000 (13:07 -0500)]
LP#1746577 Websocket responder exits on jabber disconnect
Regularly check for Jabber socket disconnects in the websocket gateway
"responder" thread (that relays messages from opensrf to the WS client)
and force a client disconnect when a broken jabber socket is detected.
Signed-off-by: Bill Erickson <berickxx@gmail.com> Signed-off-by: Chris Sharp <csharp@georgialibraries.org> Signed-off-by: Jason Stephenson <jason@sigio.com>
LP#1717350: fix chunking messages sent from Perl services
The chunk size adjustments introduced by the patches for bug 1709710
could result in calculating non-integral chunk sizes for Perl services.
This in turn led to fractional offsets and lengths being passed to
Perl's substr() function; rounding in turn can lead to characters
in the response getting silently dropped, which in turn broke
parsing the reconstituted response.
To test
-------
The problem can be reproduced by invoking
Mike Rylander [Fri, 18 Aug 2017 15:43:31 +0000 (11:43 -0400)]
LP#1709710: Make chunk sizing smart about XML quoting
XML inside JSON as a quoted string that's itself inside XML causes quite the
pile up of nested excaping of certain characters in OpenSRF PARTIAL_RESPONSE
messages. Here we check for the worst offenders (<, >, &, and ") and account
for the cost of escaping them in chunked response stanzas.
Signed-off-by: Mike Rylander <mrylander@gmail.com> Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org> Signed-off-by: Bill Erickson <berickxx@gmail.com> Signed-off-by: Jason Stephenson <jason@sigio.com> Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Chris Sharp [Thu, 11 May 2017 18:47:32 +0000 (14:47 -0400)]
LP#1690206 - remove check of httpd.conf from OpenSRF Makefile.install
The original src/extras/Makefile.install included a grep of the
file /etc/apache2/httpd.conf, which is no longer installed by default
on supported Debian and Ubuntu releases. As this check results in
an error message, it makes sense to remove the check altogether.
Signed-off-by: Chris Sharp <csharp@georgialibraries.org> Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Confirm that a child process is alive just before attempting to write to
its pipe. If the child process is dead, log the error, then drop the
message and move on. This allows the parent to continue servicing
future requests.
Signed-off-by: Bill Erickson <berickxx@gmail.com> Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Under some circumstances, osrf_control --diagnostic may not
be able to deduce the correct max_children setting for a service,
e.g., if it's run without --localhost on a system that doesn't
have a opensrf.xml config section specifying active apps for a
specific hostname. When that happens, just display the count
of running drones rather than displaying error messages about
undefined $dmax values and divisions by zero.
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org> Signed-off-by: Bill Erickson <berickxx@gmail.com>
--diagnostic output shows the maximum number of allowed drones per
service along with the active drone count. Additionally, a usage
percentage value is displayed.
Dan Wells [Fri, 21 Jul 2017 18:17:34 +0000 (14:17 -0400)]
LP#1635737 Add optional context to interval_to_seconds
Any given interval (e.g. "1 month") can be a different amount of
seconds depending on the context (i.e. "1 month" after February 1 is
March 1, but "1 month" after March 1 is April 1, yet March is longer
than February). This affects months all the time, but also can affect
days, hours, and even seconds once you consider DST and "leap" times.
By giving an optional context to interval_to_seconds, you can find the
true number of seconds in, for example, "1 month", when starting from
"February 1" (the context).
Signed-off-by: Dan Wells <dbw2@calvin.edu> Signed-off-by: Mike Rylander <mrylander@gmail.com>
Jason Stephenson [Wed, 12 Jul 2017 19:24:48 +0000 (15:24 -0400)]
LP 1703958: Update Websockets Intructions for Debian Jessie
Modify the Websockets installation instructions so that users will
have a working installation on Debian Jessie. We change the "Debian"
instructions to say "Debian Wheezy" and add "Debian Jessie" to the
list with "Ubuntu Trusty / Xenial" where necessary.
Signed-off-by: Jason Stephenson <jason@sigio.com> Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Previously, following the optional Nginx server setup
instructions resulted in failure for nginx to install
because Apache is already using ports 80 and 443. Switch
the steps so that we change Apache's listening ports before
APT installation.
Signed-off-by: Chris Sharp <csharp@georgialibraries.org> Signed-off-by: Ben Shum <ben@evergreener.net>
All WebSockets communication occurs via SSL in the sample configuration
files. Non-SSL communication is still an option if required with local
configuration.
Signed-off-by: Bill Erickson <berickxx@gmail.com> Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
This patch adds the ability to specify the WebSockets
port as a configure option, avoiding the need to manually
edit a couple JavaScript files if one chooses to proxy
WS traffic.
This patch also cleans up the set of JavaScript files that
are installed so that some test case files are not installed
by default.
Mike Rylander [Thu, 4 Aug 2016 12:57:44 +0000 (08:57 -0400)]
LP#1616501: teach mod_perl handlers how to detect client disconnects
This patch provides an API so that mod_perl handlers
that act as OpenSRF clients have a way to specify that
if the browser disconnects, to stop trying to receive
results from an XMPP request.
To invoke it, mod_perl handlers can add the following:
use OpenSRF;
...
sub hander {
...
my $r = shift;
OpenSRF->OSRF_APACHE_REQUEST_OBJ($r);
...
Signed-off-by: Mike Rylander <mrylander@gmail.com> Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Galen Charlton [Wed, 15 Feb 2017 19:12:34 +0000 (14:12 -0500)]
LP#1652382: handle cases where supplied key is longer than 250 bytes
With this patch, if cache clients want to use a key longer
than the memcached text protocol limit of 250 bytes, the
key is normalized to 'shortened_' + md5_hex(normalized_key).
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org> Signed-off-by: Jeff Davis <jdavis@sitka.bclibraries.ca>
Mike Rylander [Fri, 27 Jan 2017 20:25:05 +0000 (15:25 -0500)]
LP#1652382: normalization of memcache keys in C code
Memcache does not allow spaces in keys, so here we will actively strip them
from any key we get from a caller. Some callers are not very proactive about
sending clean keys, and this patch prevents issues that can poison C-based
OpenSRF service backends.
Signed-off-by: Mike Rylander <mrylander@gmail.com> Signed-off-by: Kathy Lussier <klussier@masslnc.org> Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org> Signed-off-by: Jeff Davis <jdavis@sitka.bclibraries.ca>
Galen Charlton [Thu, 22 Dec 2016 10:53:12 +0000 (15:53 +0500)]
LP#1652122: fix infinite recursion in opensrf.system.method.all
Under certain circumstances, calling opensrf.system.method.all on a
Perl service can result in an infinite recursion when attempting to
serialize an OpenSRF::Application object to JSON. In particular,
this was observed to happen when doing an introspection of
the opensrf.settings service.
This patch avoids the infinite recursion (and consequent memory
leak) by ensuring that the 'session' key is slated for exclusion
from serialization from OpenSRF::Application objects during
bootstrapping.
Note that the problem does not affect all Perl services; if a
Perl service declares at least one streaming method, the auto-registration
of the .atomic method will result in 'session'-stripping.
This patch fixes a regression introduced in bug 1350457.
To test
-------
[1] Run 'introspect opensrf.settings' via srfsh; observe
that it never returns and that the opensrf.settings drone
will grow in memory sized until killed.
[2] Apply the patch, then repeat step 1. This time, the
request should succeed.
Signed-off-by: Galen Charlton <gmc@esilibrary.com> Signed-off-by: Mike Rylander <mrylander@gmail.com>
- Use "OSRFVERSION" in the master branch rather than
a specific version number; this is meant to be changed
during the release process.
- Update references to the OpenSRF downloads index
page.
Remington Steed [Mon, 21 Nov 2016 15:58:33 +0000 (10:58 -0500)]
LP#1382038: Add instructions for implied download/unpack step
Occasionally, new users have complained that the installation
instructions making too many assumptions about what a user knows. This
commit explicitly instructs users in downloading the source tarball,
unpacking it, and changing the working directory so they will be ready
for the next instructions.
This patch also refactors the code that actually does the
splitting and sending of chunked responses into a new
public function, osrfSendChunkedResult().
Signed-off-by: Galen Charlton <gmc@esilibrary.com> Signed-off-by: Ben Shum <ben@evergreener.net> Signed-off-by: Mike Rylander <miker@esilibrary.com>
Mike Rylander [Thu, 25 Aug 2016 21:42:31 +0000 (17:42 -0400)]
LP#1631522: Dispatch mode for method_lookup subrequests
There is a pattern in the wild of using OpenSRF's method_lookup() facility
to decide between one of several local methods when delegating to pre-existing
logic. Often times, we want to simply hand control over to another method,
but the output of a subrequest's run() is an array of results. The caller has
to know if, and how, to restructure the result for the client.
Instead, we can now call dispatch() instead of run() and have OpenSRF session
control completely passed to the delegate code. This way, the delegate code
need not know anything about its caller, and vice versa.
Signed-off-by: Mike Rylander <mrylander@gmail.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Galen Charlton [Tue, 1 Nov 2016 19:46:13 +0000 (15:46 -0400)]
LP#1612771: don't adjust max_stanza_size during installation
As the typical max_stanza_size for ejabberd installations
is larger than what OpenSRF now needs, this patch adjusts
the installation instructions to remove the step to change
max_stanza_size.
Bill Erickson [Thu, 27 Feb 2014 20:18:15 +0000 (15:18 -0500)]
LP#1612771: set Perl / C max_chunk_size default sizes
default max bundle size == 25K
default max chunk size == 50K
Note with Ejabberd using 65536 as the default max stanza size, these
new OpenSRF defaults mean that all messages will fit the default
message size constraints -- i.e. no more need to raise the
max_stanza_size.
Signed-off-by: Bill Erickson <berick@esilibrary.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
* Added missing max_chunk_size method to AppSession
* Copy API max_chunk_size value into the handler AppRequest
* Fix error where no-chunking resulted in empty responses
Signed-off-by: Bill Erickson <berick@esilibrary.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch is first in a series of patches that provides the following
features:
* OpenSRF message bundling -- Pack multiple OpenSRF messages together
in a single XMPP envelope, as long as we believe more messages will be
sent in the future and we are below some threshold of combined message size.
The default for that threshold is 25Kb.
* OpenSRF message chunking -- Break up large OpenSRF messages across
multiple XMPP envelopes. This is implemented with a new OpenSRF message type.
C, Perl, and Javascript libraries are taught how to reconstruct chunked
messages. The default chunking threshold is 50Kb, just a bit below the default
ejabberd max stanza size of 64Kb.
This patch in particular renames "chunking" to "bundling", then
implements message splitting ("chunking") in Perl using two new
oilsResult subclasses
Signed-off-by: Mike Rylander <mrylander@gmail.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
When an OpenSRF client is run with syslog enabled and with the
OSRF_ADOPT_SYSLOG environment variable set to a true value, no attempt
is made to modify the syslog configuration, including no calls to
openlog()/closelog() and no modification of the syslog facility when
calling syslog().
Signed-off-by: Bill Erickson <berickxx@gmail.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Mike Rylander [Fri, 7 Oct 2016 16:19:52 +0000 (12:19 -0400)]
LP#1631520: configure install location of Perl modules
Add --with-perlbase configure option to specify
an alternative location for installing the Perl modules. This
can be useful for setups that want to run the Perl modules
from a shared filesystem or environments that need to run
multiple versions of OpenSRF simultaneously.
Users of --with-perlbase are responsible for ensuring that
PERL5LIB is set appropriately.
To test
-------
[1] Use --with-perlbase during the configure step, e.g.,
./configure --perl-base /tmp/perl
[2] Run make; make check; sudo make install
[3] Verify that the Perl modules are installed under
/tmp/perl.
[4] Make a change to a Perl source file, then
go to src/perl, then run sudo ./Build install. Verify
that it remembers the --with-perlbase directory
and installs the updated module there.
Signed-off-by: Mike Rylander <mrylander@gmail.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Currently, there is no protocol-level mechanism for passing the client's
desired timezone to the server. In much the same way we pass the locale,
we can let the server know what timezone it should use when interpreting
time stamps.
To do this we:
* Teach perl server code to live in the client TZ, if supplied
* Teach perl client code to send the current $ENV{TZ}
* Teach javascript library to include client TZ in
gateway/translator/websocket communication
* Teach C code to pull the incoming TZ and apply it to outgoing messages
* Teach srfsh to pull TZ from the environment and pass it with requests
Signed-off-by: Mike Rylander <mrylander@gmail.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Chris Sharp [Fri, 19 Feb 2016 01:12:40 +0000 (20:12 -0500)]
LP#1551090: Adding apache2-dev dependency to xenial and fixing whitespace
Signed-off-by: Chris Sharp <csharp@georgialibraries.org> Signed-off-by: Jason Stephenson <jason@sigio.com> Signed-off-by: Ben Shum <ben@evergreener.net>
Conflicts:
src/extras/Makefile.install
Chris Sharp [Thu, 18 Feb 2016 23:10:34 +0000 (18:10 -0500)]
LP#1551090: Since we move apache to the "install_extra_debs*" targets,
we need to move debian_sys_config further down to compensate.
Signed-off-by: Chris Sharp <csharp@georgialibraries.org> Signed-off-by: Jason Stephenson <jason@sigio.com> Signed-off-by: Ben Shum <ben@evergreener.net>
Chris Sharp [Thu, 18 Feb 2016 00:35:02 +0000 (19:35 -0500)]
LP#1551090: Adding necessary connectivity for xenial deb installation.
Signed-off-by: Chris Sharp <csharp@georgialibraries.org> Signed-off-by: Jason Stephenson <jason@sigio.com> Signed-off-by: Ben Shum <ben@evergreener.net>
Chris Sharp [Thu, 18 Feb 2016 00:26:01 +0000 (19:26 -0500)]
LP#1551090: Adding apache2 package to Makefile.install deb list.
Signed-off-by: Chris Sharp <csharp@georgialibraries.org> Signed-off-by: Jason Stephenson <jason@sigio.com> Signed-off-by: Ben Shum <ben@evergreener.net>
Chris Sharp [Wed, 17 Feb 2016 20:28:05 +0000 (15:28 -0500)]
LP#1551090: Updating Makefile to accommodate ubuntu-xenial target.
Removing some redundancy in the extra debs lists.
Signed-off-by: Chris Sharp <csharp@georgialibraries.org> Signed-off-by: Jason Stephenson <jason@sigio.com> Signed-off-by: Ben Shum <ben@evergreener.net>
Conflicts:
src/extras/Makefile.install
Now that Debian Squeeze's LTS (long-term support) period
has ended, Evergreen no longer offers community support
for that distribution. This patch removes references
to Squeeze from the installation scripts and documentation.
To test:
[1] Verify that Debian Squeeze is no longer referenced in
the installation documentation.
Signed-off-by: Galen Charlton <gmc@esilibrary.com> Signed-off-by: Ben Shum <ben@evergreener.net>
Mike Rylander [Wed, 30 Jul 2014 17:29:46 +0000 (13:29 -0400)]
LP#1350457: Pass caller's session to subrequests called via method_lookup
In the process of looking up a method for an internal subrequest, we lose
session info. This is a problem when the subrequest makes a remote request,
because then the subrequest can't look up the proper locale, among other
things. The forthcoming branch passes the caller's session to the subrequest.
This patch also teaches OpenSRF object registration how to strip certain
object members -- in particular, the session -- so that introspection
continues to work.
Signed-off-by: Mike Rylander <mrylander@gmail.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Mike Rylander [Thu, 10 Sep 2015 20:56:13 +0000 (16:56 -0400)]
LP#1494486: Limit damage caused by dropped drone XMPP sockets
It is apparently possible for drones to get into a state where their XMPP
socket is closed but they don't notice. This is bad because the drone can
continue to receive requests from its listener but can no longer respond
to them. To limit the pain this can cause, we should kill the drone as soon
as we notice this condition.
To avoid overhead, this commit notices when the socket returns an error (or
raises a signal, in Perl) upon write, and exits immediately. One message
will be lost, but the drone will no longer be a black hole that does nothing
but absorb requests it can never fill.
To test
-------
[1] Start an OpenSRF stack and look for a drone process.
[2] Use lsof to identify which socket that drone is using
to talk to XMPP.
[3] Use gdb to attach to the process and close the socket, e.g.,
$ gdb -p $PID
(gdb) p close(11) # or whatever the socket number was
(gdb) c
[4] Use srfsh to make requests of that service. Eventually, one
of them will hit the drone.
[5] Sans patch, the request will get handled by the drone, but
the results will never get sent, and the drone will remain
available to handle other requests.
[6] With the patch, the drone will exit when it discovers that it
can no longer write to the XMPP socket.
Signed-off-by: Mike Rylander <mrylander@gmail.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>