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:
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.
Thereafter the test is marked as "skipped":
After every run a file is created in COBOL-3\New_Configuration.bin
, e. g. 5872mfunit-state.dat
. It contains the following error message:
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.
Update 3: VMMAP output before running the test:
After the error message appears:
Update 4: JVM version seems to be 1.8.
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
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:
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:
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
User contributions licensed under CC BY-SA 3.0