Page 1 of 1

Error on yajl_copyBufStr

Posted: Thu Apr 28, 2022 12:15 pm
by imaxeman69
I'm getting the following error after executing this code:
output = yajl_copyBufStr();
Automatic storage overflow.
Function check. MCH4429 unmonitored by OWSSRVPGM at statement 0000000638,
instruction X'0000'.

The output is defined as varchar(2000000);

I am getting valid JSON because I'm doing a YAJL_saveBuf and the IFS file is valid.

Re: Error on yajl_copyBufStr

Posted: Fri Apr 29, 2022 1:20 am
by Scott Klement
RPG has a limit of 16 mb total of automatic storage.

I want to emphasize, that's a TOTAL for all variables in automatic storage. So every variable in automatic storage must add up to < 16 MB of storage, or you will get an overflow.

You could potentially move some of the storage into heap storage or use teraspace.

Re: Error on yajl_copyBufStr

Posted: Thu May 05, 2022 5:23 pm
by imaxeman69
So I just decided to do a yajl_saveBuf. The system will be single threaded so there is no chance on other processes stomping on this. If I need to, I can always use a temp file.

Does yajl_saveBuf hold a lock on the IFS file? Here is the layout:
Program A calls a sub-procedure in a service program to build the JSON. That sub-procedure does the yajl_saveBuf();
Flow returns to program A, which is trying to do this:
http_req('POST':
url:
'/mwalter/result.json':
*omit:
'/mwalter/buffer.json':
*omit:
'application/json');

My partner is telling me that there is no Body. No JSON. Which is causing an error. I've tried http_stmf() as well. No joy there either. Could there be some sort of lock on the /mwalter/buffer.json file? I can look at the file and see the JSON.

We're working on trying to get Fiddler to intercept the request, but that's another bridge to jump off of.

THank you.

Re: Error on yajl_copyBufStr

Posted: Thu May 05, 2022 5:34 pm
by Scott Klement
imaxeman69 wrote: Thu May 05, 2022 5:23 pm Does yajl_saveBuf hold a lock on the IFS file?
No, there's no lock placed on it. It has a reference to it while yajl_saveBuf is active, but releases the reference at the end. But, I don't think that's what you mean by "lock" -- I suspect you're thinking of it like a PF rather than a STMF. That type of lock doesn't really exist on a STMF.
imaxeman69 wrote: Thu May 05, 2022 5:23 pm Here is the layout:
Program A calls a sub-procedure in a service program to build the JSON. That sub-procedure does the yajl_saveBuf();
Flow returns to program A, which is trying to do this:
http_req('POST':
url:
'/mwalter/result.json':
*omit:
'/mwalter/buffer.json':
*omit:
'application/json');
You are ignoring any errors, here. Not sure if that's intentional or not?
imaxeman69 wrote: Thu May 05, 2022 5:23 pm My partner is telling me that there is no Body. No JSON. Which is causing an error. I've tried http_stmf() as well. No joy there either. Could there be some sort of lock on the /mwalter/buffer.json file? I can look at the file and see the JSON.
A lock doesn't make sense, here. Create a debug/trace file to see what's happening during the HTTP communications.

Code: Select all

http_debug(*on: '/tmp/imaxeman69-trace.txt');
Look at the data, see if it's sending the buffer.json file contents. See what it's sending you back.

Re: Error on yajl_copyBufStr

Posted: Thu May 05, 2022 6:33 pm
by imaxeman69
Thanks Scott.