Comment 11 for bug 1709710

Revision history for this message
Galen Charlton (gmc) wrote : Re: OpenSRF Installation Instructions for ejabberd

So, I've tracked it down -- the default chunk size is a bit too low for certain MARCXML-heavy responses to be chunked properly. Consider a request like this:

open-ils.cstore open-ils.cstore.json_query {"from":["unapi.biblio_record_entry_feed","{234,233,230,235,223,215,244,212,221,225}","marcxml","{holdings_xml,mra,acp,acnp,acns,bmp,cbs}","CONS","0","acn=>5,acp=>5",null,null,"1"]}

The result will include a lot of XML containing quotes and brackets:

  <datafield tag="028" ind1="3" ind2="0"><subfield code="a">HL50498715...

which gets converted to JSON as part of the payload of an OpenSRF transport message:

  <datafield tag=\"028\" ind1=\"3\" ind2=\"0\"><subfield code="a">HL50498715...

which, if too large, gets converted to JSON in chunks:

  <datafield tag=\\\"028\\\" ind1=\\\"3\\\" ind2=\\\"0\\\"><subfield code="a">HL50498715...

and converted to XML, and wrapped in an XMPP message, resulting in

  &lt;datafield tag=\\\\\\\&quot;028\\\\\\\&quot; ind1=\\\\\\\&quot;3\\\\\\\&quot; ind2=\\\\\\\&quot;0\\\\\\\&quot;&gt;&lt;subfield code=\\\\\\\&quot;a\\\\\\\&quot;&gt;HL50498715&lt;

The maximum chunk size is currently OSRF_MSG_CHUNK_SIZE == 2 * OSRF_MSG_BUNDLE_SIZE == 2 * 25600 == 51200, but that gets applied when splitting up the original payload as initially converted to JSON. If the payload is primarily XML and has a lot of quotes and brackets that end up getting escaped and converted to entities... I've seen chunks of 51200 bytes of payload ended up become XMPP messages larger than 66000 bytes.