OS/2, eCS & ArcaOS - Technical > Programming

RUX function failure - but on multiple tries only...

(1/3) > >>

Dariusz Piatkowski:
Umm...I'm scratching my head here because I wrote this script a couple of years ago and it has been rock-solid.

The purpose is to check the connectivity between my box and the NAS, which sometimes just flat-out "goes away". Re-starting the NetDrive control fixes it.

Alright, so here is what I call:


--- Code: ---...
/* check ifthe RXU - RXU.DLL - is required */
   IF rxu_api_required = 1 THEN DO
      /* check if the DLL is already loaded */
      rxu_api = RxFuncQuery('rxuinit')
      msg_text="RXU: already in memory, RC="||rxu_api
      IF rxu_api <> 0 THEN DO
         CALL RxFuncAdd 'rxuinit','RXU','rxuinit'
         CALL rxuinit
         msg_text="RXU: loaded into memory, RC="||rxu_api
         END
      CALL debug debug_flag calling_code msg_level msg_text
     
      /* RXU version API returns a WHOLE bunch of stuff, so parse it first */
      rxu_api_info=rxuquery()
      msg_text=substr(rxu_api_info,pos(',',rxu_api_info,1)+2,pos(',',rxu_api_info,1))
      msg_text="RXU: Using version "||msg_text
      CALL debug debug_flag calling_code msg_level msg_text
      END
...

--- End code ---

This normally gives me the following output:


--- Quote ---DEBUG : MAIN => Initializing...
DEBUG :    ==> library_load => Initializing...
DEBUG :    ==> library_load => RXU: loaded into memory, RC=1
DEBUG :    ==> library_load => RXU: Using version v1.a
DEBUG :    ==> library_load => RXUTILEX: loaded into memory, RC=1
DEBUG :    ==> library_load => RXUTILEX: Using version 0.1.6
DEBUG :    ==> library_load => Exiting...
DEBUG : MAIN =>

--- End quote ---

During the first run I'm all good, no problems.

However, re-runing the 2nd time and aftewards causes this CLI error msg to be produced:


--- Quote ---   282 +++         rxu_api_info = rxuquery();
REX0043: Error 43 running G:\UTIL\MISC\nas_check.cmd, line 282: Routine not
found

--- End quote ---

...and produces the following matching LOG:


--- Quote ---DEBUG : MAIN => Initializing...
DEBUG :    ==> library_load => Initializing...
DEBUG :    ==> library_load => RXU: already in memory, RC=0
   282 +++         rxu_api_info = rxuquery();
REX0043: Error 43 running G:\UTIL\MISC\nas_check.cmd, line 282: Routine not
found
    76 +++   Call library_load;

--- End quote ---

The weird part is that this seems to have literally just started on Sep-26th...prior to that I never saw any such failures...ugghhh???

Is there anything obviously wrong that i'm doing here?

BTW - in my code I check to see if I need a particular REXX DLL, if YES, I load it and then un-load it when my script has completed running.

Andi B.:

--- Quote --- I load it and then un-load it when my script has completed running.
--- End quote ---
I'm not a REXX expert in any way. And what I've to say probably will have anything to do with your problem. But, once I read you should never unload a rexx dll. AFAIR this is because there might be other rexx scripts running which still needs the dll loaded. Maybe my memory is wrong on this, but....

Dariusz Piatkowski:
Hi Andi,


--- Quote from: Andi B. on September 29, 2022, 08:55:19 am ---I'm not a REXX expert in any way. And what I've to say probably will have anything to do with your problem. But, once I read you should never unload a rexx dll. AFAIR this is because there might be other rexx scripts running which still needs the dll loaded. Maybe my memory is wrong on this, but....

--- End quote ---

You are NOT wrong about that. I had initially implemented this when the DLL load & un-load was still a known problem (OS/2 kernel). Today however this is not the case anymore. Given the situation today I could probably either leave things alone (meaning, just load the required DLL and leave in place), or modify my code to check whether the DLL was already loaded and if found to have been so, leave it alone and not un-load at the end of the script.

The only thing is: I have no idea what changed, just over a couple of days actually...I was experimenting with the JFS cache MIN & MAX buffer sizes, so the last reboot was on the 26th and since then I noticed that my dropped NAS connection reared it's ugly head...LOL!

Lars:
As Andy has said: never ever unload a REXX DLL and always just load it when you need it, regardless if it was loaded or not (it is not an error to load a REXX DLL that has already been loaded).

This is NOT a kernel problem (problem of DLL not unloading, bla bla bla). It is a problem of the way the REXX interpreter works internally. It manages the concurrent access to REXX Function DLLs in a way that is unfortunate, to say the least.

Remy:

--- Quote from: Dariusz Piatkowski on September 29, 2022, 03:00:21 am ---Umm...I'm scratching my head here because I wrote this script a couple of years ago and it has been rock-solid.

The purpose is to check the connectivity between my box and the NAS, which sometimes just flat-out "goes away". Re-starting the NetDrive control fixes it.

Alright, so here is what I call:


--- Code: ---...
/* check ifthe RXU - RXU.DLL - is required */
   IF rxu_api_required = 1 THEN DO
      /* check if the DLL is already loaded */
      rxu_api = RxFuncQuery('rxuinit')
      msg_text="RXU: already in memory, RC="||rxu_api
      IF rxu_api <> 0 THEN DO
         CALL RxFuncAdd 'rxuinit','RXU','rxuinit'
         CALL rxuinit
         msg_text="RXU: loaded into memory, RC="||rxu_api
         END
      CALL debug debug_flag calling_code msg_level msg_text
     
      /* RXU version API returns a WHOLE bunch of stuff, so parse it first */
      rxu_api_info=rxuquery()
      msg_text=substr(rxu_api_info,pos(',',rxu_api_info,1)+2,pos(',',rxu_api_info,1))
      msg_text="RXU: Using version "||msg_text
      CALL debug debug_flag calling_code msg_level msg_text
      END
...

--- End code ---

This normally gives me the following output:


--- Quote ---DEBUG : MAIN => Initializing...
DEBUG :    ==> library_load => Initializing...
DEBUG :    ==> library_load => RXU: loaded into memory, RC=1
DEBUG :    ==> library_load => RXU: Using version v1.a
DEBUG :    ==> library_load => RXUTILEX: loaded into memory, RC=1
DEBUG :    ==> library_load => RXUTILEX: Using version 0.1.6
DEBUG :    ==> library_load => Exiting...
DEBUG : MAIN =>

--- End quote ---

During the first run I'm all good, no problems.

However, re-runing the 2nd time and aftewards causes this CLI error msg to be produced:


--- Quote ---   282 +++         rxu_api_info = rxuquery();
REX0043: Error 43 running G:\UTIL\MISC\nas_check.cmd, line 282: Routine not
found

--- End quote ---

...and produces the following matching LOG:


--- Quote ---DEBUG : MAIN => Initializing...
DEBUG :    ==> library_load => Initializing...
DEBUG :    ==> library_load => RXU: already in memory, RC=0
   282 +++         rxu_api_info = rxuquery();
REX0043: Error 43 running G:\UTIL\MISC\nas_check.cmd, line 282: Routine not
found
    76 +++   Call library_load;

--- End quote ---

The weird part is that this seems to have literally just started on Sep-26th...prior to that I never saw any such failures...ugghhh???

Is there anything obviously wrong that i'm doing here?

BTW - in my code I check to see if I need a particular REXX DLL, if YES, I load it and then un-load it when my script has completed running.

--- End quote ---

If you would like be sure that all RXU functions you are going to call are loaded, you can check each of them at init and if some are missing, load them then instead of just testing 'rxuinit'

Navigation

[0] Message Index

[#] Next page

Go to full version