jump to article
...intermittent thoughts

Transforming LSI_info() to GetThreadInfo()

The undocumented function call LSI_Info() is suspected to cause trouble (read, crashes) on various occasions in Notes and Domino. So while using an undocumented function is not recommendable at all, this one seems to be a real cause of pain in many cases. We have seen servers that had LotusScript code using LSI_info() calls in them crashing mystically. So we have started to iron out calls to LSI_Info() as a step in stabilizing these servers, even though we have rarely made use of this function anyway. And it proofed to be helpful.

As the information that is retrieved by LSI_Info is extremely helpful in many occasions, simply removing those calls is not the best solution. Instead, replacing calls to LSI_Info() by appropriate other calls is much better. Most of the information provided by LSI_Info() can also be retrieved by its adult sister GetThreadInfo() which is not only documented but also supported. As for the other information that is not retrievable by GetThreadInfo(), I have no idea how to retrieve it other than by using LSI_Info() - but I would personally prefer a stable server and not to have that information as a server that is instable and maybe shows me some more information on rare scenarios.

For all the Information that is retrievable, simply replacing the keyword "LSI_Info" by "GetThreadInfo" is not applicable as both functions take different values to retrieve the same information. As a note to myself and to others who are attempting to do modify their code I have put together a parameter mapping of both calls. The parameters for LSI_Info() are taken from Johan Känngård, those for GetThreadInfo() come from Lotus/IBM:

LSI_Info()GetThreadInfo()
Current line number (in the LS source)Lsi_Info(1)GetThreadInfo(0) or GetThreadInfo(LSI_THREAD_LINE)
Name of current procedure (i.e. function, sub or property)Lsi_Info(2)GetThreadInfo(1) or GetThreadInfo(LSI_THREAD_PROC)
Name of current module (i.e. ScriptLibrary name)Lsi_Info(3)GetThreadInfo(2) or GetThreadInfo(LSI_THREAD_MODULE)
LotusScript version numberLsi_Info(6)GetThreadInfo(3) or GetThreadInfo(LSI_THREAD_VERSION)
(Human) language setting (e.g. 'en' for english)Lsi_Info(9)GetThreadInfo(4) or GetThreadInfo(LSI_THREAD_LANGUAGE)
Country or region settingn/aGetThreadInfo(5) or GetThreadInfo(LSI_THREAD_COUNTRY)
Current clock ticksn/aGetThreadInfo(6) or GetThreadInfo(LSI_THREAD_TICKS)
Clock ticks per second (supported only on platforms that support parallel processing primitives)n/aGetThreadInfo(7) or GetThreadInfo(LSI_THREAD_TICKS_PER_SEC)
Current process ID (supported only on platforms that support parallel processing primitives)n/aGetThreadInfo(8) or GetThreadInfo(LSI_THREAD_PROCESS_ID)
Current task ID (supported only on platforms that support parallel processing primitives)n/aGetThreadInfo(9) or GetThreadInfo(LSI_THREAD_TASK_ID)
name of the procedure that called this one (i.e. the caller)Lsi_Info(12)GetThreadInfo(10) or GetThreadInfo(LSI_THREAD_CALLPROC)
name of the calling modulen/aGetThreadInfo(11) or GetThreadInfo(LSI_THREAD_CALLMODULE)
LotusScript Memory AllocatedLsi_Info(50)n/a
LotusScript Memory Allocated from OSLsi_Info(51)a/a
LotusScript Blocks UsedLsi_Info(52)n/a

Hope this helps not only me but others as well.