OpenEdge.NET.HttpHeaderBuilder returns a 504 Gateway Time ou

Posted by onnodehaan on 25-Feb-2019 23:08

Hi guys

I've written a piece of code to upload a file to a REST-service using the new HttpHeaderBuilder classes. This works fine on 11.7.3.  The file is uploaded correctly; we use this in production with multiple customers.

However, when I run the exact same code on a slightly older OpenEdge version, 11.6.3.022, it returns a 504 Gateway Timeout error after 1 minute.


I can't find any clues on the Knowledge Base, so I'm hoping someone has some pointers for me because I'm a bit los for now :-)  

See this snippet below to see the simplified structure of the code,


assign oMultiEntity = new MultipartEntity()
   oMultiEntity:Boundary = guid
   oAttachment = new OpenEdge.Core.Memptr(ipFileContent)
   oPart = new OpenEdge.Net.MessagePart('application/octet-stream':U, oAttachment)
   oPart:ContentId = 'filedata':U
   cUrl = 'https://':U + cHost + '/api/attachments?id=':U + cId.

oPart:Headers:Put(HttpHeaderBuilder:Build('Content-Disposition':U)
  :Value('form-data; name="filedata"; filename="':U + ipFileName + '"':U)
  :Header).

oMultiEntity:AddPart(oPart).
oRequest = RequestBuilder:Post(cUrl, oMultiEntity)
   :AddHeader('Content-Type':U, 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW2':U)
   :Request.

oResponse = ClientBuilder:Build():Client:Execute(oRequest).

// After 1 minute i get back a 504 - Gateway Timeout on OpenEdge 11.6.3.022,  but on OpenEdge 11.7.3 everything works fine

All Replies

Posted by Peter Judge on 26-Feb-2019 02:26

There was an issue with quoted boundaries in the Content-Type header: there are posts on Communities about it (and there’s a hot/fix for it in 11.7).  Though that may not be relevant here (since you’re not quoting the boundary value).
 
To see what’s different between the 2 versions, run with -debugalert and/or a log-manager with logging-level=5 and compare the request-raw.txt that’s written into the session temp-dir. That’s help figure out what changes caused the good behaviour.
 
 
 
 
 

Posted by onnodehaan on 07-Mar-2019 23:19

Hi Peter

It took me a while, but i have the tracing. The request body looks good. After one minute, the response is an empty file. This is the relevant logging. I; ve replaced the actuel host with <HOST>.

"[19/03/01@12:57:52.335+0100] P-002162 T-226215744 1 AS -- (Procedure: 'sys/apps/mtcouploadattachment.p' Line:345) https://<HOST>/v1/attachments?ddName=h49g5efg6Yu2uk858_purchaseInvoice&externalId=12345&fieldName=attachment&environmentId=ENV001&actionType=replace"

"[19/03/01@12:57:52.38 4+0100] P-002162 T-226215744 1 AS HTTPCLIB       REQUEST: FILE= /v1/temp/request-raw.txt"

"[19/03/01@12:57:52.386+0100] P-002162 T-226215744 1 AS HTTPCLIB       RESPONSE: FILE= /v1/temp/response-data-received.txt"

"[19/03/01@12:57:52.386+0100] P-002162 T-226215744 1 AS SOCKET         CONNECT: -H app.bizzstream.com -S 443 -ssl     "

"[19/03/01@12:57:52.474+0100] P-002162 T-226215744 1 AS SOCKET         CONNECT: TIME(ms)=87"

"[19/03/01@12:57:52.932+0100] P-002162 T-226215744 1 AS SOCKET         WRITE: TIME(ms)=456"

"[19/03/01@12:57:52.932+0100] P-002162 T-226215744 1 AS SOCKET         WRITE: SIZE(b)=463727"

ONE MINUTE TIME OUT ......

"[19/03/01@12:58:53.301+0100] P-002162 T-226215744 1 AS SOCKET         READ: AVAIL(b)=500"

"[19/03/01@12:58:53.301+0100] P-002162 T-226215744 1 AS SOCKET         READ: TIME(ms)=0"

"[19/03/01@12:58:53.301+0100] P-002162 T-226215744 1 AS SOCKET         READ: SIZE(b)=500"

"[19/03/01@12:58:53.301+0100] P-002162 T-226215744 1 AS HTTPCLIB       CHUNK: NUM= 1"

"[19/03/01@12:58:53.301+0100] P-002162 T-226215744 1 AS HTTPCLIB       CHUNK: SIZE(b)= 8192"

"[19/03/01@12:58:53.301+0100] P-002162 T-226215744 1 AS HTTPCLIB       CHUNK: READ(b)= 500"

"[19/03/01@12:58:53.316+0100] P-002162 T-226215744 1 AS SOCKET         READ: COMPLETE= yes"

"[19/03/01@12:58:53.316+0100] P-002162 T-226215744 1 AS SOCKET         READ: ERROR= ?"

"[19/03/01@12:58:53.316+0100] P-002162 T-226215744 1 AS SOCKET         READ: TOTAL TIME(ms)=60384"

"[19/03/01@12:58:53.316+0100] P-002162 T-226215744 1 AS SOCKET         READ: TOTAL SIZE(b)=500"

"[19/03/01@12:58:53.319+0100] P-002162 T-226215744 1 AS SOCKET         DISCONNECT: -H <HOST> -S 443 -ssl     "

"[19/03/01@12:58:53.319+0100] P-002162 T-226215744 1 AS -- (Procedure: 'sys/apps/mtcouploadattachment.p' Line:370) 504"

Posted by gus bjorklund on 08-Mar-2019 14:50

looks like the other end is waiting to get the 463727 bytes of data but you never sent it.

Posted by Peter Judge on 12-Mar-2019 15:18

Interesting. Are there any differences between the request-raw files in 11.7 and 11.6 ?   The 504 that’s returned means that the server is sending a response (even if it’s not a good one or one that you want).
 
There was an issue a while ago with SSL payloads, but I’m 98.372% sure that it’d been fixed in 11.6.3.
 
 

Posted by onnodehaan on 12-Mar-2019 15:36

Hi Peter,

I'm a bit stuck with tech support, who wants a reproduction, so we have decided to upgrade the ERP system to  a newer version, which is shipped with 11.7.3

I haven't seen this issue on 11.7.3,  so I'm hoping that the problem goes away after upgrading.

Posted by Peter Judge on 13-Mar-2019 10:08

Ah, ok. If that works for you then all’s good.
 
I am still curious about why the server responds with the 504, so if you have both the 11.6.3 and 11.7.3 request-raw.txt files,  and some time, feel free to email them to me and I can look if there’s anything obviously different.
 
 

Posted by onnodehaan on 18-Mar-2019 19:45

After migrating to OpenEdge 11.7.3 the problem disappeared strangely enough. The exact same code worked fine.

This thread is closed