httpapir4 failing every 94th execution

Discussions related to HTTPAPI (An HTTP Client Package for RPG programming.) http://www.scottklement.com/httpapi/
Post Reply
ngkbart
Posts: 2
Joined: Tue Feb 22, 2022 4:18 pm

httpapir4 failing every 94th execution

Post by ngkbart »

First of all, thank you to everyone for your consideration of this issue...

We are using version 1.38 on V7R1.

We have a service program that periodically calls an http (not SSL) webservice on a remote system. The program checks a table for records, and if present, and unsent, the program builds an xml file and calls the webservice for each record. Then it goes to sleep and repeats.

Every 94th iteration, the program goes MSGW.

Of interest in the joblog:

Message: Length or start position is our of range for the string operation.
Cause: One of the following has occurred in RPG procedure COMMTCP_FD in program LIBHTTP/HTTPAPIR4: - A numeric length or start position is less than 1 or too large for the string operation. - The search-argument parameter of the %SCAN built-in function has zero length or is longer than the source-string parameter. The maximum-length parameter of the %STR built-in function is not a value between 1 and the maximum size of a character field.

The outcome of this is a 0 byte response file from the webservice call. Typically, a response file is <1KB.

I've run a wireshark capture , and confirmed that the issue is definitely on the 400 side, as the httpapi_debug.txt indicates. When this failure occurs, the last line in httpapi_debug.txt is "Nagle's algorithm (TCP_NODELAY) disabled.

Wireshark shows that the 400 initiates the tcp connection, the remote system ACKs, and the 400 SYN,ACKs.
And then nothing else happens until the remote system closes the connection 20 seconds later.

On a successful run, as soon as the 400 SYN,ACKs, it begins pushing http data to the remote system (i.e. the webservice call).


This is the debug file on a broken execution...

HTTPAPI Ver 1.38 released 2017-10-09
NTLM Ver 1.4.0 released 2014-12-22
OS/400 Ver V7R1M0

http_setauth(): entered
http_url_post(): entered
http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver retrans: 2
DNS resolver retry : 2
DNS resolver options: x'00000136'
DNS default domain: NGKACU.COM
DNS server found: 172.22.4.5
DNS server found: 172.22.4.30
Nagle's algorithm (TCP_NODELAY) disabled.

Let me know what other info I can provide to help troubleshoot. Disclosure: I'm not the developer, I'm the support guy. But I can get answers from the developer if needed.
Scott Klement
Site Admin
Posts: 658
Joined: Sun Jul 04, 2021 5:12 am

Re: httpapir4 failing every 94th execution

Post by Scott Klement »

Update to a current version of HTTPAPI, that logic has already been rewritten.
ngkbart
Posts: 2
Joined: Tue Feb 22, 2022 4:18 pm

Re: httpapir4 failing every 94th execution

Post by ngkbart »

Thank you for your rapid response. We will upgrade.
Post Reply