Article
· Jan 11 2m read

What to do with the error 5369: Class is currently being compiled by process

InterSystems FAQ rubric

This error occurs when an instance of the class is already open at compile time.

There are two ways to deal with this issue:

  1. Terminate the process or application that has the instance open
  2. Compile options in the studio build menu: Check the compile flag “Compile classes in use” and compile.  

If you want to determine which process is using the class, try the sample routine below.

 

/// Test.mac
search(classname) public {
    Set pid=""
    Set pid=$order(^$Job(pid))
    While pid'="" {
        Do checkVars(pid,classname)
        Set pid=$Order(^$Job(pid))
    }
} checkVars(pid,string) {
    Set $ztrap="err"
    Set var="" 
    For {
        Set var=$zu(88,1,pid,var) q:var=""  
        Set val=$zu(88,2,pid,var)
        If val[string {
            Write !,pid,":",var," = ",val,!
        }
    }
    Quit err
    Set $ztrap=""
    Quit
}

This sample routine searches the user process's local variables to see if they use the specified class.

≪Execution example≫

USER>do search^Test("Test.Person")
 
2352:p1 = 1@Test.Person
6324:p2 = 2@Test.Person

*In this case, the processes with Pid=2352 and Pid=6324 are using Test.Person.

Discussion (1)1
Log in or sign up to continue

Instantiated classes can be compiled with no error since....long time, I think at least Cachè 2017 but I might be wrong.

This is also documented here:

Compiling When There Are Existing Instances of a Class in Memory

If the compiler is called while an instance of the class being compiled is open, there is no error. The already open instance continues to use its existing code. If another instance is opened after compilation, it uses the newly compiled code.

However, the code to scan all processes variables is good to know/useful!