Question Norman W. Freeman · Feb 25

I have a global with multiple nodes : 

^A("ABC") = ""
^A("DEF") = ""
^A(123) = ""

How to create a new single node in that global, in a way it's always at the end of the global (eg: this will be the very last node being enumerated)

I end up with this code but maybe there is a cleaner and simpler approach : 

set ^A($char(65535)) = "" //should be bigger than any character inserted
set ^A($char(255)) = ""   //some systems does not seems to support >255 characters, this might be safer

I only need to write it once, this code is not intended to be used in a loop or something, just to add something at

6
0 148
Question Norman W. Freeman · Nov 5, 2025

The following regex is matching while I think it should not :

write $match("♥","\?") //print '1' (unexpected)

It should only match the '?' character. I think what happen is the ♥ character got converted to '?' (as it's not within regular ascii range) before being validated by the regex engine.

In fact, this give a clue about what happen : 

write $char($ascii("♥")) //print '?'

Is this an IRIS well known limitation, is there workarounds ? Should I report it to InterSystems ?

In my case, a way to detect non standard ascii code in a string will be good enough.

8
0 120
Question Norman W. Freeman · Jul 7, 2025

In IRIS, every time a request need to be processed, a specific IRIS process (IRISDB.EXE) need to be assigned to handle that request.

If there is no spare IRIS process at that time, process will need to be created (and later destroyed). On some Windows systems (especially with security/antimalware solutions being active) creating new processes can be slow, which can results in delays during peak times (due to inrush of requests).

2
0 121
Question Norman W. Freeman · Jun 27, 2025

I have notified that on several servers the IRISTEMP database is reported as only a few GB in size while on the disk where it's located, the IRIS.DAT file is much bigger (eg: 3GB reported in Portal (including free space) while file on the disk file is 121GB). The last modification date of IRIS.DAT is recent so I'm not looking into a location no more in use.

Is there an explanation for that difference in size ? 

I know temporary databases are special in a way they are not always stored on the disk, here is what InterSystems says about it :

Changes to temporary globals are not written to disk.

4
0 152
Question Norman W. Freeman · Jun 10, 2025

I have a database that is 2TB in size (from a LIVE system).

I would like to defragment it but I have some questions. I took a look at official documentation but it does not help.

  • Is is possible to get a measurement about how much database is fragmented ? (eg: a percentage). Most operating systems are able to give a an indication about how much a filesystem is fragmented before any operation.
  • The database is on a LIVE server, the IRIS service is restarted every night (around 1AM). Because of that I can't run defragment continuously. I don't think it will be able to complete under 24 hours.
10
0 201
Question Norman W. Freeman · May 20, 2025

Hello,
I have created this script that does lot of writes to a single global. DB write performance is much slower than expected (compared to another similar systems).

set rec = "..." //fill it with something
set time = $piece($horolog,",",2)
while(($piece($horolog,",",2)-time) < 30) //30 seconds
    set ^A($System.Util.CreateGUID()) = rec
}

I have notified the following : 

  • CPU usage does not reach 100% on a single core (eg: 25% of total CPU usage should be seen on a 4 cores system).
9
1 228
Question Norman W. Freeman · May 7, 2025

I use the following code to protect some code for being called by multiple processes at same time :

lock +^TEMP("FOO"):0 //don't wait
quit:'$test
//critical section
//...
lock -^TEMP("FOO")

This works between processes but it does not prevent the same process entering critical section twice.

How to do that, is there any lock option ? I would like it to behave as the lock in C# or Java.

It's OK for me to use something else than LOCK instruction (eg : signals)

8
0 197
Question Norman W. Freeman · Nov 15, 2024

I use the following code to calculate the SHA1 of a file :

set stream = ##class(%Stream.FileBinary).%New()
do stream.LinkToFile(filename)
write $SYSTEM.Encryption.Base64Encode($SYSTEM.Encryption.SHA1HashStream(stream))

This code is called thousands of time and performance is critical. I have tried to code same logic in another language (which is lower level) and it's almost twice as fast. It's unclear why so I started investigating.

Using Process Monitor, it shows that files are read in chunks of 1024 bytes (1K) which is suboptimal. Reading a file of 1MB while require 1024 file system calls.

2
0 248
Question Norman W. Freeman · Nov 7, 2024

Is there any mechanism already implemented in IRIS to prevent XSS exploits ? 

This case happen when user input html/javascript content into fields and submit the page. If saved content is rendered as is, it's going to be executed by anyone visiting the page.

What I am looking for : 

  • Built-in protection mechanisms that can be enabled globally (eg: per web application) or per CSP page. Something similar to a web application firewall.
  • Functions to call manually that can detect such content in fields or sanitize them (remove unwanted content).
4
0 312
Question Norman W. Freeman · Oct 26, 2024

I'm using $system.obj.load() to synchronize a folder contains many classes (CLS) in UDL format. I use "-d" as flag (compilation is done later one). It's already done in parallel to make it as fast as possible but I was wondering if there was way to make this even faster, for example using some tradeoffs (eg: by turning off some features before loading them all (that would be re-enabled later on)). It's currently taking 250 seconds to import 3000 classes. MAC file and GBL import is much faster.

5
0 236
Question Norman W. Freeman · Oct 8, 2024

I have an IRIS installation that is using 8-bit charset encoding (set to deu8 / Latin 1). I would like to convert everything (database and system)  to Unicode

Charset encoding is something asked during installation, is it possible to change this on the fly ? The installer clearly say that Unicode systems cannot be converted. What about 8 bit ? 

Same for database : is there possible conversion ?

My current plan is the following :

- export all globals from 8-bit instance
- install a new Unicode instance
- import all globals into Unicode instance

Is there a simpler approach ?

5
0 608
Question Norman W. Freeman · Oct 2, 2024

If several application servers are connected using ECP, and one of them create many locks, so many that lock table became full :

Should we expect only that application server to be impacted ? (usually, when lock table is full the system became instable). Or, are other application servers going to be impacted the same way ? (because that lock table is synchronized and maintained in sync across all servers)

I have another question (which is related) : is this the same with remote databases ?

3
0 152
Question Norman W. Freeman · Aug 14, 2024

I use the following code to loop trough all globals : 

set name=""
for
{
   set name=$order(^$GLOBAL(name))
   quit:name=""
   write name,!
}

However this is really slow : about 1second per node. 

I ran debugger, and it seems most of the time is spend in "%SYS.GD Visible" function. There is a comment that says : 
"Sees if globals in dataset are visible to our namespace"
This function loop on a global named  ^mtemp which contains lot of records (10K or more).
I have cleared global, hoping it has been filled by another process but it's not (it seems to be filled by %SYS.

5
0 309
Question Norman W. Freeman · Jun 27, 2024

I have a class that inherit from AbstractException

I would like to create a new constructor that has 5 parameters :

Class Foo Extends %Exception.AbstractException
{
    Method %OnNew(arg1 As %String, arg2 As %String, arg3 As %String, arg4 As %String, arg5 As %String) As %Status
    {
        quit ##super("some message")
    }
}

I cannot compile it : 

ERROR #5478: Keyword signature error in Foo:%OnNew, keyword 'method argument/s signature' must be '%Library.String,%Library.String,%Library.String,%Library.String,%Exception.

6
0 319
Question Norman W. Freeman · Feb 1, 2024

A class (and routine) definition can sometimes differ from it's compiled state.
When such a thing occurs, a "+" sign will be shown in the tab of the file opened in Studio.

I would like to do the same check programmatically.

For routines, it's very simple : 

set routine=##class(%Routine).%New(name)        
write routine.UpToDate

For classes, I could not find the equivalent. The only solution I found so far is to compare the compilation date and definition date :

set classCompiled = ##class(%Dictionary.CompiledClass).%OpenId(name)            
set classDefinition = ##class(%Dictionary.
4
0 275
Question Norman W. Freeman · Dec 20, 2023

I am using the event logger from CSP gateway with level "v9r" enabled, in order to dump the raw content of some HTTP requests.

I would like to decode the body response data, when it's in binary form. AFAIK the event logger will convert characters outside the 32-127 range (EBCDIC) to the "\xff" notation (where ff is a hexadecimal value). Here is an example :




Content What is written in the log Remark
helloworld helloworld  
hello £ world hello \xc2\xa3 world £ is C2A3 in Unicode
hello \xc2\xa3 world hello \xc2\xa3 world same as line above !
4
0 1384
Question Norman W. Freeman · Oct 30, 2023

The following code call the method of the same name as defined in the nearest superclass:

Class MyClass Extends %Persistent
{
  ClassMethod Foo()
  {
  }
}

Class SubClass Extends MyClass
{
  ClassMethod Foo()
  {
      do ##super() // <----
  }
}

Not let's say I want to call Foo() super class method but from another method :

Class SubClass Extends MyClass
{
  ClassMethod AnotherMethod()
  {
      do ##super().Foo() //will not work
  }
}

This is possible in some other programming languages such as C# or Java.

I cannot find anything in documentation

8
0 656
Question Norman W. Freeman · Oct 4, 2023

I have some code that fire this kind of request very often : 

set request = ##class(%Net.HttpRequest).%New()
set request.Server = ... //always the same 
set request.Location = ... //always the same 
do request.EntityBody.Write(...) //this is different from one request to another
do request.Post() 

If it was called in a loop I could move the HttpRequest instantiation outside, unfortunately this is not the case.

3
0 336
Question Norman W. Freeman · Aug 31, 2023

I have notified the following :

  • Web Gateway usually maintain a certain amount of TCP/IP connections (that is capped to Maximum Connections) with Super server process (also named %SYS.SERVER). Those connections will stay, even after some client requests (eg: browser) have been processed and the TCP/IP connections have been closed the other side (between client and webserver, usually Apache).
5
0 307
Question Norman W. Freeman · Aug 25, 2023

I have enabled Audit in Portal for monitoring license usage. 

When the system is under load, this event appears quite often :  




Event Source Event Type Event User Web Session Description
%System %Login Login UnknownUser     %Service_WebGateway 

It does not seems to cause issue with licensing , still, I am wondering why it's there and how it works (what cause such events).

After some tests (on a non production environment, not under load), here is what I have found out :

  • this event can occurs when accessing static resources like a CSS or JS file. I don't get that.
4
0 282
Question Norman W. Freeman · Aug 4, 2023

Hello,
I would like to do the following :

set name = $name(^A)
for i=1:1:10
{
    set $qsubscript(name, i) = "TEST"_i //dream code that does not work
}
set @name = "" //will create ^A("TEST1", "TEST2", "TEST3", ... , "TEST10") = ""

Unfortunately, unlike $PIECE(), $QSUBSCRIPT() is not bidirectional.

Is there a way to do what I described, in a clean way ? (something supported by the system) 

I would like to avoid :

- using a custom made solution (eg: appending keys one by one to a string, adding commas when needed) unless it's failproof (eg: can deal with commas in keys, non string

6
0 307
Question Norman W. Freeman · Jul 27, 2023

There is several classes that allow to create TCP/IP connections (eg: to connect to a service).

Example : %Net.FtpSession (port 21), %Net.HttpRequest (usually port 80 or 443)

AFAIK connection will stay open unless closed explicitly or if variable that hold the instance is garbage collected.

Is there a way to get a list of all active (open) TCP/IP connections IRIS is maintaining so far ?

I took a look at Portal (eg: in dashboard, "System Resource Statistics") but couldn't find anything. Web Gateway panel provide information about connections but this is incoming connections for CSP pages.

6
0 709
Question Norman W. Freeman · Jul 18, 2023

Hello,

I am looking for information about garbage collector. I already looked at documentation but I could not find anything about it.
Here is some questions :

1) is there a garbage collector per process (each process has it's own memory and GC is done per process) or is it global (eg: shared memory) ?
I know there is some memory allocated per process at startup but also globally (gmheap).
2) when a GC / cleanup occurs somewhere,  is it possible that it block the other processes for a short moment ? (eg: a "stop the world" GC that pause everything while job is being done).

3
0 494
Question Norman W. Freeman · Jul 10, 2023

I have several 1GB journals from a LIVE server that I would like to inspect (eg: check which globals have been updated over the time).

Is there a simple way to view those journals using another IRIS instance ? (eg: local installation).

I have been tempted to put those files directly into the journal folder of my local installation and restart the system, however I am concerned that the transactions they contains will be restored and will corrupt the local database.

I have checked documentation but couldn't find anything.

10
1 525
Question Norman W. Freeman · Jul 6, 2023

Based on your experience, do you know any reason why IRIS would enter a deadlock/hang state ? 

When such thing occurs, it's no more possible to connect to Portal or Studio, despite IRIS service (IRIS.EXE processes) being still active. CPU/memory/network usage are usually very low (eg: it does not occurs because server is overloaded). The only fix is a full restart of IRIS (eg: by clicking on IRIS icon in notification toolbar and choosing appropriate action).

I had that issue on a production server a few weeks ago.

6
0 506
Question Norman W. Freeman · Jun 9, 2023

Hello,

I would like to get a list of all globals that have been read or written during a given context. In Portal, there are counters in dashboard that give the number of read/write to globals in general.

What I am looking for : 

- some handler (eg: like $ZTRAP) that will be called everytime something is read/written to a global.

- to activate a "global log mode" in Portal that will dump some information to a file (like ^ISCSOAP for SOAP requests).

I understand this is something that can considerably slow down IRIS, but it's intended to be used only for debbuging and under no load.

2
0 384
Question Norman W. Freeman · May 7, 2023

I did some experiments on my local machine and found out that IRIS seems to associate each request (eg: CSP request) to a dedicated process named IrisDB.exe

This process has 3 threads, and one of them seems to be the main working thread (that will the handle request).

If I spawn many concurrent requests, the number of IrisDB processes on my local machine will grow (to make sure each request can be handled in parallel).

It seems there is a limit : it will create no more than 64 processes to handle requests (eg: even if 100 concurrent requests are send to IRIS).

3
0 659
Question Norman W. Freeman · Apr 4, 2023

I use the following code to grab 509 certificate and show private key :

set x509 = ##class(%SYS.X509Credentials).GetByAlias("foo")
write x509,!
write x509.OwnerList,!
write x509.PrivateKey,!

It works perfectly fine under Studio (eg: when called from output window) :

29@%SYS.X509Credentials
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKC...

However, it fails when called in the context of a CSP request. I got a stack trace when displaying content of PrivateKey :

6@%SYS.X509Credentials
0??%Admin_Secure:USE MYNAMESPACE?-e^zPrivateKeyGet+2^%SYS.X509Credentials.1^1e^^User.www.1^1B^zOnPage+7^User.

5
0 509
Question Norman W. Freeman · Mar 9, 2023

I use the following query to get a list of all classes : 

select * from %Dictionary.ClassDefinition 
where System=0 and Hidden=0 

It works, but AFAIK it return all classes from all namespaces, including the ones defined in %SYS (usually classes they starts with % like %CSP).

I would like to get only classes of current namespace. I have checked all the columns returned by the query and none allow to filter on a given namespace.

The solution I am looking for does not need to be a query, the query I posted above is called from code.

1
1 981