gsk_env_init: (GSKit) Storage allocation request failed.

Discussions related to HTTPAPI (An HTTP Client Package for RPG programming.) http://www.scottklement.com/httpapi/
Post Reply
AnthonyO
Posts: 3
Joined: Mon Jan 23, 2023 8:23 pm

gsk_env_init: (GSKit) Storage allocation request failed.

Post by AnthonyO »

Hi all,
Been using HTTPAPI for years, thank you!

We are currently on version 1.39.

Every so often we receive the following error when posting to endpoints, and we are trying to track down the root of the error.
gsk_env_init: (GSKit) Storage allocation request failed.

Some of our jobs are continually running, and we're wondering if something didn't close down properly when ssl connection issues arise.
When our error occurs, we've noticed we've also received prior errors in the job:

SSL Handshake: (GSKit) Peer not recognized or badly formatted message received.
SSL Handshake: (GSKit) I/O: A connection with a remote socket was reset by that

Has anyone experienced anything similar?
We're looking at some of the source code "COMMSSLR4", and we noticed we only issue a "gsk_secure_soc_close" after a timeout from a "gsk_secure_soc_init".
We are wondering if that it always should be issued if there were any errors during a "gsk_secure_soc_init"? Our thought here is that we may have some half baked work still in memory.

Code: Select all

0410.00  c                   eval      rc = gsk_secure_soc_init(wwSslh)        
0411.00  c                   if        rc <> GSK_OK                            
0412.00  c                   if        rc = GSK_IBMI_ERROR_TIMED_OUT           
0413.00  c                   callp     SetError(HTTP_SSTIMO: 'Time out during '
0414.00  c                               'SSL handshake')                      
0415.00  c                   callp     gsk_secure_soc_close(wwsslh)            
0416.00  c                   return    *OFF                                    
0417.00  c                   endif                                             
0418.00  c                   callp     SetError(HTTP_SSSNFD: 'SSL Handshake: ' 
0419.00  c                               ssl_error(rc))                        
0420.00  c                   return    *OFF                                    
0421.00  c                   endif                                             
Thanks!
Scott Klement
Site Admin
Posts: 635
Joined: Sun Jul 04, 2021 5:12 am

Re: gsk_env_init: (GSKit) Storage allocation request failed.

Post by Scott Klement »

Yes, anytime it returns *OFF from CommSSL_Upgrade, it should be cleaning up the socket with gsk_secure_soc_close().

So, that does sound like a possible bug... it should look more like this:

Code: Select all

c                   eval      rc = gsk_secure_soc_init(wwSslh)         
c                   if        rc <> GSK_OK                             
c                   if        rc = GSK_IBMI_ERROR_TIMED_OUT            
c                   callp     SetError(HTTP_SSTIMO: 'Time out during '+
c                               'SSL handshake')                       
c                   callp     gsk_secure_soc_close(wwsslh)             
c                   return    *OFF                                     
c                   endif                                              
c                   callp     SetError(HTTP_SSSNFD: 'SSL Handshake: ' +
c                               ssl_error(rc))                         
c                   callp     gsk_secure_soc_close(wwsslh)             
c                   return    *OFF                                     
c                   endif                                              
AnthonyO
Posts: 3
Joined: Mon Jan 23, 2023 8:23 pm

Re: gsk_env_init: (GSKit) Storage allocation request failed.

Post by AnthonyO »

Thank you for checking Scott.

How often do you make new releases? We're wondering if we should wait for a new release, or make a change to the source code ourselves. What would you recommend? Thanks.
Scott Klement
Site Admin
Posts: 635
Joined: Sun Jul 04, 2021 5:12 am

Re: gsk_env_init: (GSKit) Storage allocation request failed.

Post by Scott Klement »

I make new releases when I find a need to make one... there's no schedule, its just done when needed.

Seems like the change is trivial, why not just make it?
AnthonyO
Posts: 3
Joined: Mon Jan 23, 2023 8:23 pm

Re: gsk_env_init: (GSKit) Storage allocation request failed.

Post by AnthonyO »

Seems trivial enough. Thanks!

We are using the standard default libhttp. Can you post the correct compile statement for COMMSSLR4?
Scott Klement
Site Admin
Posts: 635
Joined: Sun Jul 04, 2021 5:12 am

Re: gsk_env_init: (GSKit) Storage allocation request failed.

Post by Scott Klement »

You can just run the INSTALL program, it will compile everything.
Post Reply