1. Martin Eismann
  2. PowerBuilder
  3. Tuesday, 11 June 2024 16:06 PM UTC

Dear Appeon Powerbuilder guys,

I'm using PB 2022 (R1) MR 1900 32bit.

During processing the response of a HTTP-POST-Request using a loop, PB crashes unexpectedly during concatenation of the incoming Blob-data.

This is my code:

HTTPClient	lrc_DocEngine

//....some code before....

lrc_DocEngine.AutoReadData = FALSE
li_Err = lrc_DocEngine.SendRequest("POST", ls_URL, blb_Multipart)
IF ( li_Err = 1 ) THEN
	li_HTTP_Status = lrc_DocEngine.GetResponseStatusCode()

	IF (li_HTTP_Status = 200) THEN
		TRY
			li_rc = 1
			DO WHILE (li_rc = 1)
				blb_NextData = Blob("")
				li_rc = lrc_DocEngine.ReadData(blb_NextData, 1024*16)
				blb_RawData += blb_NextData
			LOOP
			
			// THIS LINE IS NEVER REACHED
			ls_ResponseBody = String(blb_RawData, EncodingUTF8!)

		CATCH (RuntimeError lex_Runtime)
			// ... does not throw anytime!

		FINALLY
		END TRY
	END IF
END IF

The cought runtime exception does not throw anytime!

So I commented the concatenation and added some code to write the incoming Blob-data into a file, PB DOESN'T crash.

HTTPClient	lrc_DocEngine

//....some code before....

lrc_DocEngine.AutoReadData = FALSE
li_Err = lrc_DocEngine.SendRequest("POST", ls_URL, blb_Multipart)
IF ( li_Err = 1 ) THEN
	li_HTTP_Status = lrc_DocEngine.GetResponseStatusCode()

	IF (li_HTTP_Status = 200) THEN
		TRY
			ls_Response_Test_File = "C:\TEMP\RESPONSE.DAT"
			ll_FileHdl = FileOpen(ls_Response_Test_File, StreamMode!, Write!, LockWrite!, Replace!, EncodingUTF8!)
			li_rc = 1
			DO WHILE (li_rc = 1)
				blb_NextData = Blob("")
				li_rc = lrc_DocEngine.ReadData(blb_NextData, 1024*16)
				FileWrite(ll_FileHdl, blb_NextData)
				//blb_RawData += blb_NextData
			LOOP
			
			// THIS LINE WOULD BE REACHED (but blb_RawData is empty here)
			ls_ResponseBody = String(blb_RawData, EncodingUTF8!)

		CATCH (RuntimeError lex_Runtime)
			// ... does not throw anytime!

		FINALLY
			FileClose(ll_FileHdl)
		END TRY
	END IF
END IF

The size of the generated file RESPONSE.DAT is approx. ~230 MB. 

 

Does PB 2022 have limitations regarding to Blob size or is there a know issue regarding to concatenation?

Kind Regards

Martin



There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.