Error 249 (Process killed (by mfunit)) when running a unit test in Microfocus Visual COBOL for Eclipse

0

I have a simple COBOL program (inside a Visual Cobol for Eclipse project), which calculates the maximum size of the binary gap and prints the result. Now I want to create a unit test and then modify the program so that the result is returned to the testing framework.

There is a unit test project in a separate directory. In Eclipse, the project structure looks like this:

Screenshot

This is the code of automatically generated unit test.

When I run it in Eclipse, I first get a Windows error message

Error when launching application (0xc0000142). To exit the application, press OK.

Screenshot

Screenshot

Thereafter the test is marked as "skipped":

Screenshot

After every run a file is created in COBOL-3\New_Configuration.bin, e. g. 5872mfunit-state.dat. It contains the following error message:

Screenshot

File COBOL-3\New_Configuration.bin\MFUT_TESTBINARYGAP-syserr.txt is empty. COBOL-3\New_Configuration.bin\MFUT_TESTBINARYGAP-sysout.txt contains the output of my program (as expected):

BIN-REP
00000100000000000000000000000000
CTR
06
CTR:
06
CTR:
05
CTR:
04
CTR:
03
CTR:
02
CTR:
01
MAX-GAP-SIZE:
00

File COBOL-3\New_Configuration.bin\COBOL-TEST.mfu contains

[global]
fixture-filename=COBOL-TEST
preferred-cwd=C:\usr\dp\dev\java-mainframe\01-BinaryGap\COBOL-3\New_Configuration.bin
preferred-runner=mfurun
preferred-64bit-runner=true
isolate=true
report=noprintfile
report=nomarkdown
ignore-return-code=false
exit-code=true
cleanup=false

[MFUT_TESTBINARYGAP]
source.filename=C:\usr\dp\dev\java-mainframe\01-BinaryGap\COBOL-3\TestBinaryGap.cbl
source.lineno=17
source.seqfilename=C:\usr\dp\dev\java-mainframe\01-BinaryGap\COBOL-3\TestBinaryGap.cbl
source.seqno=172
collection.info=COBOL-TEST
setup=true

File COBOL-3\New_Configuration.bin\TestBinaryGap.obj.1.tlog contains:

#"C:\PROGRA~2\Micro Focus\Visual COBOL\bin64\cobol.exe" C:\usr\dp\dev\java-mainframe\01-BinaryGap\COBOL-3\TestBinaryGap.cbl DELINT USEC:\usr\dp\dev\java-mainframe\01-BinaryGap\COBOL-3\New_Configuration.bin\mfant1904268475359773097.dir ;
^C:\usr\dp\dev\java-mainframe\01-BinaryGap\COBOL-3\TestBinaryGap.cbl
!C:\usr\dp\dev\java-mainframe\01-BinaryGap\COBOL-3\mfunit_prototypes.cpy
?C:\usr\dp\dev\java-mainframe\01-BinaryGap\COBOL-3\mfunit_prototypes.cpy
!$COBCPY\mfunit_prototypes.cpy
+"C:\Program Files (x86)\Micro Focus\Visual COBOL\cpylib\mfunit_prototypes.cpy"
!C:\usr\dp\dev\java-mainframe\01-BinaryGap\COBOL-3\mfunit.cpy
?C:\usr\dp\dev\java-mainframe\01-BinaryGap\COBOL-3\mfunit.cpy
!$COBCPY\mfunit.cpy
+"C:\Program Files (x86)\Micro Focus\Visual COBOL\cpylib\mfunit.cpy"
-"C:\Program Files (x86)\Micro Focus\Visual COBOL\cpylib\mfunit.cpy"
-"C:\Program Files (x86)\Micro Focus\Visual COBOL\cpylib\mfunit_prototypes.cpy"
!C:\usr\dp\dev\java-mainframe\01-BinaryGap\COBOL-3\mfunit.cpy
?C:\usr\dp\dev\java-mainframe\01-BinaryGap\COBOL-3\mfunit.cpy
!$COBCPY\mfunit.cpy
+"C:\Program Files (x86)\Micro Focus\Visual COBOL\cpylib\mfunit.cpy"

How can I fix this?

The goal is to create a minimal test (which may pass or fail, but doesn't crash like now) and then, gradually, add logic to it (it must be gradual because I'm not very experienced with COBOL).

Update 1: I changed the value of the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems\Windows from

%SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,20480,768 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=sxssrv,4 ProfileControl=Off MaxRequestThreads=16

to

%SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,20480,1024 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=sxssrv,4 ProfileControl=Off MaxRequestThreads=16

The error persists.

Update 2: Information about the system.

Screenshot

Update 3: VMMAP output before running the test:

Screenshot before

After the error message appears:

Screenshot after

Update 4: JVM version seems to be 1.8.

Screenshot

Update 5: I changed the memory settings in the eclipse.ini file so that it looks like this:

-startup
plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.551.v20171108-1834
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-name
Visual COBOL
-feature
com.microfocus.eclipse.core.product
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.8
-XX:+UseG1GC
-XX:+UseStringDeduplication
-Xms1024m
-Xmx2056m
-Dosgi.splashPath=platform:/base/plugins/com.microfocus.eclipse.core.win32
--add-modules=ALL-SYSTEM
--add-opens=java.base/jdk.internal.loader=ALL-UNNAMED
-XX:+IgnoreUnrecognizedVMOptions
-DDSTORE_REMOTE_CLASS_LOADING_ON=true
-Denable.analysis=true
windows
eclipse
unit-testing
cobol
microfocus
asked on Stack Overflow Aug 8, 2018 by Mentiflectax • edited Aug 15, 2018 by Mentiflectax

1 Answer

1

First my disclaimer, I'm no Cobol programmer.

On the other hand, what caught my eye is the windows exception you are getting. My guess is that this is more of Windows error than Eclipse/Cobol one. This is an ancient Windows error which has been with us for maybe 30 years or so.

You forgot to mention which windows you are using (xp/vista/7/8/10, x86/x64) and how much memory you have.

The error:

Error when launching application (0xc0000142). To exit the application, press OK.

has been with windows for ages.

What does it mean? To quote the MSDN:

STATUS_DLL_INIT_FAILED which translates to:

{DLL Initialization Failed} Initialization of the dynamic link library %hs failed. The process is terminating abnormally.

In other words you are using unregistered or somehow expired dll. Usually, if your system is otherwise working, there are these reasons:

  1. Running many applications at once (exhaustion)
  2. Running application within different desktop (security)
  3. Running application as different user (security)

One guess is that you somehow exhaust your desktop Heap. You could also have issues with Desktop Heap Security (when moving between users) but with your description I think it is the first.

One possibility is that you try to load huge .dll library which does not fit into any free memory space (which is fragmented). The only way to fix it is to assign this space before and then release it to the .dll.

The things to remember:

  1. Services have smaller desktop heaps than normal (INTERACTIVE) desktop
  2. Desktop heaps are smaller on RDP sessions
  3. Desktop heap has increased with x64 systems (that was the reason why I want to know what your system is).

One way to monitor your process heap is to use the sysinternals: VMMap

To increase the memory heap (on Windows x32/x64). Open regedit

And goto:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems

Then open the last Windows key. You should find the SharedSection=a,b,c. Ignoring the a (not needed).

b is:

The second value of the SharedSection registry entry is the size of the desktop heap for each desktop that is associated with an interactive window station. The heap is required for each desktop that is created in the interactive window station (WinSta0). The value is in kilobytes (KB).

c is:

The third SharedSection value is the size of the desktop heap for each desktop that is associated with a “non-interactive” window station. The value is in kilobytes (KB).

For 32-bit operating systems, increase the b value to 12288; Increase the c value to 1024.

For 64-bit operating systems, increase the b value to 20480; Increase the c value to 1024.

(don't go over the suggested values, it could make your system behave unpredictably)

Your section should look like this for x64 system:

SharedSection=1024,20480,1024

Try to change the values and I wonder if you get the error again.

Edit It occured to me that the issue maybe hidden in the Eclipse itself and imposing a heap limit to the env:

In your eclipse.ini please change values

These are perhaps the original values:

-Xms256m
-Xmx512m

-Xms: initial start heap size

-Xmx: maximum heap size

Try these as new ones:

 -Xms1024m
 -Xmx2056m
answered on Stack Overflow Aug 15, 2018 by tukan • edited Aug 15, 2018 by tukan

User contributions licensed under CC BY-SA 3.0