Requests fail with "(GSKit) Handle is not valid" in job log

Discussions related to HTTPAPI (An HTTP Client Package for RPG programming.) http://www.scottklement.com/httpapi/
Post Reply
axelar
Posts: 7
Joined: Fri Aug 19, 2022 7:30 am

Requests fail with "(GSKit) Handle is not valid" in job log

Post by axelar »

Hi!

One of our integrations are failing when sending requests with httpapi.
The requests always fail in the production environment. In our test environment they sometimes fail, but succeed on the second attempt.

The requests fail with "(GSKit) Handle is not valid" in job log and this is all that is provided by the httpapi debug file:
It looks like it suddenly stops.

Code: Select all

HTTPAPI Ver 1.45 released 2021-09-20
NTLM Ver 1.4.0 released 2014-12-22
OS/400 Ver V7R4M0

2022-08-30-11.23.08.927332: http_persist_open(): entered
2022-08-30-11.23.08.929643: http_long_ParseURL(): entered
2022-08-30-11.23.08.929810: DNS resolver retrans: 2
2022-08-30-11.23.08.929829: DNS resolver retry  : 2
2022-08-30-11.23.08.929845: DNS resolver options: x'00000136'
2022-08-30-11.23.08.930153: DNS default domain: SITE.COM
2022-08-30-11.23.08.930176: DNS server found: 10.10.10.248
2022-08-30-11.23.08.930192: DNS server found: 10.10.10.247
2022-08-30-11.23.08.930208: DNS server found: 10.10.10.3
2022-08-30-11.23.08.930227: Resolving host api.logiq.no
2022-08-30-11.23.08.930501: inet_addr return value for this host is 4294967295
2022-08-30-11.23.08.931520: gethostbyname() returned 1442785159
2022-08-30-11.23.08.931545: Looking up service https
2022-08-30-11.23.08.931580: Service table returns port 443
2022-08-30-11.23.08.931600: https_init(): entered
2022-08-30-11.23.08.931872: QSSLPCL = *TLSV1.3 *TLSV1.2 *TLSV1.1 *TLSV1 *SSLV3
2022-08-30-11.23.08.931891: SSL version 2 support disabled
2022-08-30-11.23.08.931909: SSL version 3 support disabled
2022-08-30-11.23.08.931925: Old interface to TLS version 1.0 support enabled
2022-08-30-11.23.08.931943: TLS version 1.0 support enabled
2022-08-30-11.23.08.931959: TLS version 1.1 support enabled
2022-08-30-11.23.08.931974: TLS version 1.2 support enabled
2022-08-30-11.23.08.931990: TLS version 1.3 support enabled
2022-08-30-11.23.08.932005: initializing GSK environment
2022-08-30-11.23.09.154624: GSK Environment now available
2022-08-30-11.23.09.154667: -------------------------------------------------------------------------------------
2022-08-30-11.23.09.154686: Dump of local-side certificate information:
2022-08-30-11.23.09.154705: -------------------------------------------------------------------------------------
2022-08-30-11.23.09.154762: Nagle's algorithm (TCP_NODELAY) disabled.
2022-08-30-11.23.09.171410: SNI hostname set to: API.SITE.COM
2022-08-30-11.23.09.211294: -------------------------------------------------------------------------------------
2022-08-30-11.23.09.211329: Dump of server-side certificate information:
2022-08-30-11.23.09.211351: -------------------------------------------------------------------------------------
2022-08-30-11.23.09.211375: Cert Validation Code = 6000
2022-08-30-11.23.09.221770: -----BEGIN CERTIFICATE-----
MIIGWTCCBUGgAwIBAgIQA0FeW8lPSVjzHrjseqAN3TANBgkqhkiG9w0BAQsFADBe
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
d3cuZGlnaWNlcnQuY29tMR0wGwYDVQQDExRHZW9UcnVzdCBSU0EgQ0EgMjAxODAe
Fw0yMjA0MjEwMDAwMDBaFw0yMzA0MjEyMzU5NTlaMFYxCzAJBgNVBAYTAk5PMQ4w
DAYDVQQIEwVWaWtlbjEPMA0GA1UEBxMGSGFsZGVuMREwDwYDVQQKEwhMT0dJUSBB
UzETMBEGA1UEAwwKKi5sb2dpcS5ubzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
AQoCggEBANY8vBfqtsYuFmClzTTXMZ5uF/vqY8h7305RePTzeBD9X69HYXa6Gtqq
+S7IatMU8WFuvZDEcuGe7wQZNcUUw2rrwapXmuIcvvw8weAC9z+amKKDZ637iINV
D5q/l1WI0YFeu9z9R+OJppS7jpLRR88U+yjOMd8R3T2KsjYtoCq53PgnDQnX7c5s
Drf0dXRdjYX2PM44Sqvoyu5IC/UkYP/6zw4TU2P4DX3ZincG75aS1D3VR+5ngFxT
4sqGeqsi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4WLuWUgOj4SqY7phAj/P3
xnSKnQjc8hE5YZsVf3iL3hDn/qMkKBqeZvjNaT/2S/T7+w8OxuS0KHALeb6a6wDA
S7JalEsUwmnkcd/8DBAdZSp3Lp5/NdrWM98+RGGDiue+pPR00asiEI21osMLzFIG
jKDIC9+ItsEEekyQr9y7harl+shv/1efYKiHu0k0PRGvTP6yHMUYd+p3mujeQf3l
BsQhNi/OfN9yma6TwqKsStYz7goaRXqyQF5aj5u69r7Ox9AJBTF7yZ1xwIs2
2022-08-30-11.23.09.222506: -----END CERTIFICATE-----
Serial Number: 03:41:5E:5B:C9:4F:49:58:F3:1E:B8:EC:7A:A0:0D
Common Name: X
Country: NO
State/Province: X
Locality: X
Org Unit: X
Issuer CN: GeoTrust RSA CA 2018
Issuer Country: US
Issuer Org: DigiCert Inc
Issuer Org Unit: www.digicert.com
Version: 3
not before: 20220421020000
Unknown Field: 02:00:00 21-04-2022
not after: 20230422015959
Unknown Field: 01:59:59 22-04-2023
pub key alg: 1.2.840.113549.1.1.1
signature algorithm: 1.2.840.113549.1.1.11
Unknown Field: 0382010F003082010A0282010100D63CBC17EAB6C62E1660A5CD34D7319E6E17FBEA63C87BDF4E5178F4F37810FD5FAF476176BA1ADAAAF92EC86AD314F1616EBD90C472E19EEF041935C514C36AEBC1AA579AE21CBEFC3CC1E002F73F9A98A28367ADFB8883550F9ABF975588D1815EBBDCFD47E389A694BB8E92D147CF14FB28CE31DF11DD3D8AB2362DA02AB9DCF8270D09D7EDCE6C0EB7F475745D8D85F63CCE384AABE8CAEE480BF52460FFFACF0E135363F80D7DD98A7706EF9692D43DD547EE67805C53E2CA867AAB22D710AC0707E694BFB5E7077BDFDA157AE4C60171BAD2C2ED46832635AE47244AC9BFD355A8522E58A31DCEED2BEBCA685523787D6453C6FB91E980947E0792CC3B0203010001
Unknown Field: 2048
Unknown Field: 4766789BEC250FE4FD8CE615DB84F9FA
Unknown Field: 1.2.840.113549.2.5
Unknown Field: 46340E36E2120C669C06698B568ACFD7D364D5BD
Unknown Field: 08D76A980EB9C48DFDAB3F5CDBADE7D43D84A01B5686E4BBC8CC0ABB7CB60F4F
Unknown Field: 5
Unknown Field: *.api.site.com
Unknown Field: 0
Unknown Field: 1.3.6.1.5.5.7.3.2
Unknown Field: 1.3.6.1.5.5.7.3.1
Unknown Field: 2.23.140.1.2.2
Unknown Field: http://status.geotrust.com

2022-08-30-11.23.09.223005: Protocol Used: TLS Version 1.3
2022-08-30-11.23.09.223029: http_persist_req(POST) entered.
2022-08-30-11.23.09.223055: http_long_ParseURL(): entered
2022-08-30-11.23.09.223153: http_long_ParseURL(): entered
2022-08-30-11.23.09.223186: do_oper(POST): entered
2022-08-30-11.23.09.223443: There are 0 cookies in the cache
Any clue what could be causing this?

Thanks in advance and kind regards,
Axel
axelar
Posts: 7
Joined: Fri Aug 19, 2022 7:30 am

Re: Requests fail with "(GSKit) Handle is not valid" in job log

Post by axelar »

We tried applying this PTF https://www.ibm.com/support/pages/ptf/MF69523, to no avail.
Still the same error unfortunately.
Scott Klement
Site Admin
Posts: 636
Joined: Sun Jul 04, 2021 5:12 am

Re: Requests fail with "(GSKit) Handle is not valid" in job log

Post by Scott Klement »

I've never seen this error before. How can I reproduce it?
axelar
Posts: 7
Joined: Fri Aug 19, 2022 7:30 am

Re: Requests fail with "(GSKit) Handle is not valid" in job log

Post by axelar »

I've encountered it previously, but the requests usually succeeds when retrying. But this time it does not.

We are running 7.4.
It's TLS 1.3 with cipher TLS_AES_256_GCM_SHA384. That's what I can see when I run the request with Postman.

We are making a Post-request to this URL: [REMOVED]
You should get the same error if you try to make a simple post request to that url. You don't need authentication, as the request fails before that.
Last edited by axelar on Mon Sep 05, 2022 2:10 pm, edited 1 time in total.
axelar
Posts: 7
Joined: Fri Aug 19, 2022 7:30 am

Re: Requests fail with "(GSKit) Handle is not valid" in job log

Post by axelar »

I just got the request to work when I'm not sending anything in the body. (I got 415, Unsupported media type, which is expected)

Code: Select all

  http_debug(*ON:'/home/test/httpdebug.txt');  
  rc = http_req(
        'POST'
      : 'THE_URL'
      : '/home/test/response.txt'                      // File to receive
      : *omit                 // String to receive
      : *OMIT                 // File to send
      : ''      );              // String to send  
It could have something to do with sending multipart/form-data. I'll continue to debug.
Last edited by axelar on Mon Sep 05, 2022 2:10 pm, edited 1 time in total.
axelar
Posts: 7
Joined: Fri Aug 19, 2022 7:30 am

Re: Requests fail with "(GSKit) Handle is not valid" in job log

Post by axelar »

I think I found the error!

A program previously called http_xproc(HTTP_POINT_ADDL_HEADER:%paddr(add_headers)); without removing the procedure once it was done.
The solution was to add http_xproc(HTTP_POINT_ADDL_HEADER: *null); at the end of the program.

This is my take on why the error occured:
The program that called http_xproc finished and freed up it's memory. But the pointer to the procedure was still registered with HTTPAPI, which then later tried calling it further down the call stack.

Is it possible to make this error message more clear? :)
Scott Klement
Site Admin
Posts: 636
Joined: Sun Jul 04, 2021 5:12 am

Re: Requests fail with "(GSKit) Handle is not valid" in job log

Post by Scott Klement »

It's not clear why that would cause the problem you describe -- it should cause the application to crash, not to get a GSKit error.
Post Reply