Offline block list fails to run

Bug #493326 reported by Brandon Uhlman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Medium
Unassigned

Bug Description

OpenSRF version: 1.2.0
Evergreen version: 1.6.0.0
PG version: 8.3.8
Linux version: Ubuntu Hardy server edition (AMD64)

When trying to run /openils/bin/offline-blocked-list.pl to generate the blocking list for the offline mode of the staff client the following error is returned:

malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "Connected to OpenSRF...") at /usr/local/share/perl/5.8.8/OpenSRF/Utils/JSON.pm line 126, <GEN1> line 17582.

offline-blocked-list.pl generates a series of shell commands calling oils_requestor (the C OpenSRF query tool) to retrieve various groups of barcodes that should be blocked, executes them, then formats the output to be read by the staff client. If you make one of those commands directly, the command succeeds, and here is the output.

Connected to OpenSRF network...
oils# "23294123456789"
"4362123"
"23294234567890"
"23294345678901"
"23294456789012"
"23294567890123"
"23294678901234"
"23294789012345"
"700149274"

My suspicion, confirmed by testing, is that the 'Connected to OpenSRF Network' crashes offline-blocked-list.pl because it not a properly quoted JSON string. This is probably a result of the creep over the past several years to stricter JSON parsers. We migrated straight from 1.2.4.0, where we did not experience this error, as far as I know, to 1.6.0.0, so I am not sure when this error was introduced.

I am not submitting a patch because there are a number of possible solutions:
- toss the 'Connected to OpenSRF Network' message in offline-blocked-pl, the same way it currently tosses the 'oils#' prompt.
- quote the 'Connected to OpenSRF Network' message in oils_requestor, so it will be recognized as a valid JSON string
- remove the 'Connected to OpenSRF Network' message in oils_requestor completely

The first option is probably the best one - if there's general agreement, the fix is trivial, but I can submit a patch anyway if desired.

Related branches

Revision history for this message
Anoop Atre (anoop-atre) wrote :

OpenSRF version: 1.2.0
Evergreen version: 1.6.0.0
PG version: 8.3
Linux version: Ubuntu Hardy server edition (AMD64)

We are seeing the same issue and I went with the first suggested option - tossing the message in offline-blocked-list.pl
     next if $barcode =~ /^Connected/o; # hack to chop out the connected to opensrf notice

James Fournie (jfournie)
Changed in evergreen:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Jason Stephenson (jstephenson) wrote :

The above does not happen in 2.0 b4. Can someone confirm in 1.6.1.4?

Revision history for this message
Ben Shum (bshum) wrote :

I briefly recall trying this error out when it came up. Memory is hazy but I thought there was a fix to more recent OpenSRF versions that fixed this problem?

Tested in our 1.6.1.4 production and 1.6.1.4 community VM and could no longer replicate the failure.

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

Based on Ben's response, I'm marking this Fix Released

Changed in evergreen:
status: Confirmed → Fix Released
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.