Question
· Nov 15, 2021

Errors when using TestCoverage, 'Somebody else is using the Monitor'

When running the command 

do ##class(TestCoverage.Manager).RunTest(,"/nodelete",.userParams)

I now get the following error. these tests used to run fine.

LogStateStatus:0:TestCoverage.Manager:OnBeforeAllTests:ERROR #6060: Somebody else is using the Monitor. <<==== **FAILED**

 

Can someone please point me in the right direction?

Product version: IRIS 2021.1
Discussion (7)2
Log in or sign up to continue

Hi all,

I am also having an issue on the code coverage. On my side, there is not an error, but there are no results. 
Version: IRIS 2021.1

===============================================================================
Directory: C:\Tmp\UnitTests\MLI2\Ens\Helper\
===============================================================================
  MLI2\Ens\Helper begins ...
List items in directory started on 01/19/2022 14:18:42 '*.xml;*.XML;*.cls;*.mac;*.int;*.inc;*.CLS;*.MAC;*.INT;*.INC' Listing file C:\Tmp\UnitTests\MLI2\Ens\Helper\UnitTests.cls as udl
List finished successfully.     MLI2.Ens.Helper.UnitTests begins ...
      TestCheckAndLoadJSON() begins ...
        AssertStatusOK:Invalid Content-type. Status = OK (passed)
        AssertNotTrue:Invalid Content-type. Object = nulloref (passed)
        AssertStatusNotOK:Invalid Content-type. Validation Status = Error (passed)
        AssertEquals:Invalid Content-type. Validation SC Code(5913) = 5913 (passed)
        AssertStatusOK:No Content. Status = OK (passed)
        AssertNotTrue:No Contente. Object = nulloref (passed)
        AssertStatusNotOK:No Content. Validation Status = Error (passed)
        AssertEquals:No Content. Validation SC Code(16003) = 16003 (passed)
        AssertStatusOK:Invalid class name arg. Status = OK (passed)
        AssertNotTrue:Invalid class name arg. Object = nulloref (passed)
        AssertStatusNotOK:Invalid class name arg. Validation Status = Error (passed)
        AssertEquals:Invalid class name arg. Validation SC Code(5760) = 5760 (passed)
        AssertStatusOK:Invalid JSON. Status = OK (passed)
        AssertNotTrue:Invalid JSON. Object = nulloref (passed)
        AssertStatusNotOK:Invalid JSON. Validation Status = Error (passed)
        LogMessage:Validation SC: ERROR #5035: General exception Name 'Parsing error' Code '3' Data ''
        AssertStatusOK:Invalid Property Value. Status = OK (passed)
        AssertNotTrue:Invalid Property Value. Object = nulloref (passed)
        AssertStatusNotOK:Invalid Property Value. Validation Status = Error (passed)
        AssertEquals:Invalid property value. Validation SC Code(5802) = 5802 (passed)
        AssertStatusOK:Positive. Status = OK (passed)
        AssertTrue:Positive. Object Is Valid (passed)
        AssertStatusOK:Positive. Validation Status = OK (passed)
        AssertEquals:Positive. Object Name = MLI2.Ens.Helper.UnitTests.JSONObject (passed)
        AssertEquals:Positive. tObj.Name = Jon (passed)
        AssertEquals:Positive. tObj.Surname = Snow (passed)
        AssertEquals:Positive. tObj.Age = 35 (passed)
        LogMessage:Duration of execution: .00114 sec.
      TestCheckAndLoadJSON passed
      TestCreateJSONOutput() begins ...
        AssertStatusNotOK:Non-JSON Obj. Status = Error (passed)
        AssertEquals:Non-JSON Obj. Out Stream size = 0 (passed)
        AssertStatusOK:JSON Obj. Status = OK (passed)
        AssertEquals:JSON Obj. Out Stream = expected JSON output (passed)
        LogMessage:Duration of execution: .002102 sec.
      TestCreateJSONOutput passed
      TestGetCSPSessionId() begins ...
        AssertStatusOK:No %session. sc = OK (passed)
        AssertNotTrue:No %session. IsCSP = 0 (passed)
        AssertEquals:No %session. SessionId = "" (passed)
        AssertStatusOK:Has %session. sc = OK (passed)
        AssertTrue:Has %session. IsCSP = 1 (passed)
        AssertEquals:Has %session. SessionId = 12DFzjjakl (passed)
        LogMessage:Duration of execution: .000125 sec.
      TestGetCSPSessionId passed
    MLI2.Ens.Helper.UnitTests passed
  Skipping deleting classes 
  MLI2/Ens/Helper passed ===============================================================================
Directory: C:\Tmp\UnitTests\MLI2\Ens\Helper\UnitTests\
===============================================================================
  MLI2\Ens\Helper\UnitTests begins ...
List items in directory started on 01/19/2022 14:18:42 '*.xml;*.XML;*.cls;*.mac;*.int;*.inc;*.CLS;*.MAC;*.INT;*.INC' Listing file C:\Tmp\UnitTests\MLI2\Ens\Helper\UnitTests\FauxCSPSession.cls as udl
Listing file C:\Tmp\UnitTests\MLI2\Ens\Helper\UnitTests\JSONObject.cls as udl
Listing file C:\Tmp\UnitTests\MLI2\Ens\Helper\UnitTests\NonJSONObject.cls as udl
List finished successfully.   Skipping deleting classes 
  MLI2/Ens/Helper/UnitTests passed Mapping to class/routine coverage: .000221 seconds
Aggregating coverage data: .000185 seconds
No code coverage found (!) Use the following URL to view the result:
http://192.168.8.198:52773/csp/sys/%25UnitTest.Portal.Indices.cls?Index=147&$NAMESPACE=LIBSDEPO
Use the following URL to view test coverage data:
http://LAPTOP-H4GR74VJ:52773/csp/libsdepo/TestCoverage.UI.AggregateResultViewer.cls?Index=22
All PASSED

I've tried this this with RunTest and RunAllTests.
After running the tests:

LIBSDEPO>w $System.Status.GetErrorText(%objlasterror)
ERROR #6061: The Monitor is not running

Any advice will be appreciated.

@Stefan Cronje I've sent you a message. The discussion at https://github.com/intersystems/TestCoverage/issues/10
 is relevant but I think your root cause may be different.

Basic troubleshooting steps / things to think about:
* Is the line-by-line monitor running? (do ^%SYS.MONLBL and see what it says)
* Do you have .int code for the classes for which you're measuring coverage? (compile with the "k" flag to keep this around)
* Did you say what classes/routines you wanted to measure coverage of? (see instructions at https://github.com/intersystems/TestCoverage)

Given that two people have run into this now I think there's something that should be changed to help avoid the situation. Perhaps forcing the line-by-line monitor/PERFMON to stop (if it's running) prior to starting it for a test coverage run and/or identifying possible causes of the issue.

It's also possible that %objlasterror is leaking without that error being the root cause of any issues. I'd start by looking at how you're saying which units of code to measure coverage for - e.g., via coverage.list or an explicit list passed in to the CoverageClasses/CoverageRoutines parameter as described at https://github.com/intersystems/TestCoverage

I am back on this posting again.
I started running the tests on a Ubuntu serv

The %objlasterror still contained the error about being unable to stop the %Monitor, but this is very misleading.

What the cause of the issue was, and this might not be obvious to everyone, is the line terminators in the coverage.list file.

On Windows it was CRLF, which worked fine. When using those files on Ubuntu, the file lines are read, but including the trailing CR, which caused it not to detect the packages listed in the file correctly:(PKG(CR) '= PKG

It would be a nice to have the file loader strip out the CR's from the filestream before performing the readlines on a *nix OS.