OpenEdge.Net.pl v11.5.1 Error 'X-NODEREF or X-DOCUMENT LOAD got an error: FATAL ERROR: file 'MEMPTR'

altair

Member
Hi,



I am using OpenEdge.Net.pl (Progress v11.5.1.006) for sending requests (base64-encoded Json into a SOAP envelopp) and getting randomly, from time to time, the following error :

'X-NODEREF or X-DOCUMENT LOAD got an error: FATAL ERROR: file 'MEMPTR', line '1', column '0', message 'invalid content after root element's end tag'. (9082)

I've execute the same code 50 times in a loop, and the error is thrown at the 7th, 34th and 46th iteration, but this change at each time I launch my loop (a 2nd time, I get error on iteration 18, 31 and 47).

This error seems to be thrown when I execute the request, and more exactly, when I receive the Http response.

I've checked my client log (with entry types activated), and the stack trace seems to be this :

[18/05/23@15:23:58.518+0200] P-009012 T-009016 3 4GL 4GLTRACE Return from Write [OpenEdge.Net.HTTP.Filter.Payload.XmlBodyResponseFilter] ERROR [18/05/23@15:23:58.518+0200] P-009012 T-009016 3 4GL 4GLTRACE Return from ExtractEntity [OpenEdge.Net.HTTP.Lib.ABLSockets.ABLSocketLibrary] ERROR [18/05/23@15:23:58.533+0200] P-009012 T-009016 3 4GL 4GLTRACE Return from Execute [OpenEdge.Net.HTTP.Lib.ABLSockets.ABLSocketLibrary] ERROR [18/05/23@15:23:58.533+0200] P-009012 T-009016 3 4GL 4GLTRACE Return from Execute [OpenEdge.Net.HTTP.HttpClient] ERROR

The error is raised at : Write OpenEdge.Net.HTTP.Filter.Payload.XmlBodyResponseFilter @ 54) Progress.Lang.SysError

Looking at the source code of XmlBodyResponseFilter.cls, method Write, I can see this :
Code:
method public void Write(input poData as Object):

        define variable hDocument as handle no-undo.
        define variable oData as class Memptr no-undo.

        if not type-of(poData, Memptr) and
           not type-of(poData, ByteBucket) then
            return error new AppError(
                            substitute('Unsupported object type: &1', poData:GetClass():TypeName)
                            , 0).

        assign oData = dynamic-invoke(poData, 'GetBytes':u).

        create x-document hDocument.

        hDocument:load('memptr':u, oData:Value, false).

        assign moEntity = new WidgetHandle(hDocument).

end method.

The Line 54 is the one doing the hDocument:load from the memptr.

I'm thinking of 2 things :
- Either my code calling OpenEdge.net is wrong (but it is working most of the time) or missing something (maybe a memory leak / object not properly deleted ?)
- or maybe this is a bug in OpenEdge.Net, in the XmlBodyResponseFilter.cls.

I'm new to work with WebServices and OpenEdge.Net.pl, so maybe I am missing something.

Any idea about where this error can come from ?

For information, here is my calling code, the one which is executed 50 times : the requests (Json + Soap) remains the same :

Code:
BLOCK-LEVEL ON ERROR UNDO, THROW.

USING OpenEdge.Core.*.
USING OpenEdge.Net.HTTP.*.
USING OpenEdge.Net.HTTP.Lib.*.
USING Progress.Json.ObjectModel.*.
USING Progress.Lang.Object.

DEFINE INPUT  PARAMETER ipiIterationRun    AS INTEGER  NO-UNDO.
DEFINE OUTPUT PARAMETER oplIterationResult AS LOGICAL  NO-UNDO.

DEFINE VARIABLE oRequest      AS IHttpRequest       NO-UNDO.
DEFINE VARIABLE oResponse     AS IHttpResponse      NO-UNDO.
DEFINE VARIABLE oRequestBody  AS WidgetHandle       NO-UNDO.
DEFINE VARIABLE oLib          AS IHttpClientLibrary NO-UNDO.

DEFINE STREAM dumpErr.

DEFINE VARIABLE lcSoapEnvelop AS LONGCHAR  NO-UNDO.
DEFINE VARIABLE ptrJsonText   AS MEMPTR    NO-UNDO
DEFINE VARIABLE iErrorNum     AS INTEGER   NO-UNDO.
DEFINE VARIABLE cUrl          AS CHARACTER NO-UNDO.



/************************************************ Main Block ************************************************/


oLib = ClientLibraryBuilder:Build()
                           :sslVerifyHost(NO)
                           :Library. /*Linrary initialization stuff*/

ptrJsonText = createJsonObject(). /*create the Json that the WebService expects*/

lcSoapEnvelop = createSoapEnvelop(ptrJsonText). /*create the Soap Envelop that the WebService expects, as a LongChar*/

oRequestBody = CreateXMLObject(lcSoapEnvelop). /*create the Soap Envelop that the WebService expects, transform it in a WidgetHandle object*/

cUrl = getWebServiceUrl(). /*WebService URL*/

oRequest = RequestBuilder:post(cUrl, oRequestBody) /*Build the request with the URL and the SOAP envelop containing the Json*/             :ContentType('text/xml;charset=UTF-8')
                         :AcceptJson()
                         :Request.

oResponse = ClientBuilder:Build()
                         :UsingLibrary(oLib)
                         :Client
                         :Execute(oRequest) NO-ERROR. /*'Excecute()' mthod is where the error is raised : "'X-NODEREF or X-DOCUMENT LOAD got an error: FATAL ERROR: file 'MEMPTR', line '1', column '0', message 'invalid content after root element's end tag'. (9082)"*/

/*Error management : dump errors messages : */                    

IF ( ERROR-STATUS:ERROR OR ERROR-STATUS:NUM-MESSAGES > 0 )
THEN DO:
    OUTPUT STREAM dumpErr TO VALUE("Error_Iteration_" + STRING(ipiIterationRun) + ".txt").

    DO iErrorNum = 1 TO ERROR-STATUS:NUM-MESSAGES :  
        PUT STREAM dumpErr UNFORMATTED "Progress ERROR " + STRING(iErrorNum) + " / " + STRING(ERROR-STATUS:NUM-MESSAGES) + " : '" + ERROR-STATUS:GET-MESSAGE(iErrorNum) + "'" SKIP.
    END.          

    OUTPUT STREAM dumpErr CLOSE.

    RETURN.
END.

oplIterationResult = VALID-OBJECT(oResponse). /*in case of error 9082, the oResponse object is not valid.*/

RETURN.
 
Last edited by a moderator:

Stefan

Well-Known Member
  1. please add [ code ] tags around your code.
  2. can you get a dump of the message when it fails somehow? possibly you are getting some kind of 'please stop throttling me' message from the web service?
 

altair

Member
Fixed for the code formatting, hope it is better now.
I cannot get the Response message on my end : I am receiving an "oResponse" object (from OpenEdge.pl Execute () method) which is invalid, so at this point I can't do anything, excepts handling the error.
I will see with the guys managing the WebService, since I am not managing it myself. But from what I saw so far, they send always the same response.
 

Cecil

19+ years progress programming and still learning.
Let us know how you got on as I'm curious if it worked. Can you tell us if the payload of the XML is greater than 1MB?
 

altair

Member
Hi,
No, the payload (a plain text Json message base-64 encoded) is less than 1 Mb (4 Kb).
The ContentLength of the oResponse object is of 1229.
 
Last edited:

altair

Member
Hi,

I've tried to follow the WorkAround as per described in Defect PSC00337135 (put the attached "ClientSocketResponseWriter.cls" before OpenEdge.Net in my PROPATH) : it seems that the issue still happens, but less often (1 time out of 50), which is still not acceptable.

It seems that many bugs have been fixed since then in version 11.7, but this won't happen soon and sadly I cannot wait for the migration on this version before releasing my code.


Have you any other suggestion?

For example, is it possible to compile the source code of OpenEdge.Net.pl v11.7 under 11.5 and then "re-build" it so it will works on 11.5 ?

Or is there any known well-proofed alternatives to OpenEdge.Net.pl ?
 
Top