]> git.evergreen-ils.org Git - OpenSRF.git/commit
LP#1652122: fix infinite recursion in opensrf.system.method.all
authorGalen Charlton <gmc@esilibrary.com>
Thu, 22 Dec 2016 10:53:12 +0000 (15:53 +0500)
committerMike Rylander <mrylander@gmail.com>
Thu, 9 Feb 2017 15:35:40 +0000 (10:35 -0500)
commitbd5fc631abee9b5afb844ce0c5a20cacfabe12fb
tree612c75cea59b8192479de39edb0d22da1885fe18
parentb1d19c8b9ff0bee77a3c98e793bf8efa67693a4e
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>
src/perl/lib/OpenSRF/System.pm