Question Norman W. Freeman · Nov 5

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 ?

0
0 0
Question Norman W. Freeman · Jul 7

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).

0
0 0
Question Norman W. Freeman · Jun 27

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 :

0
0 0
Question Norman W. Freeman · May 20

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 somethingset time = $piece($horolog,",",2)
while(($piece($horolog,",",2)-time) < 30) //30 secondsset^A($System.Util.CreateGUID()) = rec
}

I have notified the following : 

0
0 0
Question Norman W. Freeman · May 7

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

lock +^TEMP("FOO"):0//don't waitquit:'$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)

0
0 0
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.

0
0 0
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.

0
0 0
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 ?

0
0 0
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)

0
0 0
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.GD)

0
0 0
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.AbstractException' or its subclass

0
0 0
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 :

4
0 200
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 1109
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

7
0 500
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 anotherdo request.Post() 

If it was called in a loop I could move the HttpRequest instantiation outside, unfortunately this is not the case. The code is called from lot of different places.

3
0 288
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 :

4
0 231
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 :

6
0 250
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 ?

6
0 545
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 431
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).

6
0 383
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 319
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 525
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 :

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

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

select * from %Dictionary.ClassDefinition 
whereSystem=0and 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 818
Question Norman W. Freeman · Feb 15, 2023

Out of curiosity, I was looking in ^ROUTINE global to see how routines are stored internally.

I found out that lot of nodes are displaying "~pointer" as associated value (eg: instead of a string).

What are those pointers ? My guess is that it references some cache internal structure (eg: some nodes inside a B-Tree).

Is there a easily way to see what is behind ? Are pointers useful for user globals or is this something purely internal to Cache database ?

1
0 279