Skip to main content

Hi!

I have a problem that seemingly occurs when calling Cobol from Java.
Note that we still use Net Express 3.1 and the mfcobol.jar that comes with it.
We have a Java application that acts as a server and calls procedural cobol to do the business logic.
With every call to cobol, the memory usage of the process gets bigger and bigger.
I checked the java heapdumps, but i couldn't find anything suspicious there.

The called program is packaged in a dll and loaded with runtime.cobload().
The dll is linked with options shared,dynamic and multi-threaded.
All calls are done with runtime.cobcall_int(...) and the parameter types are always the same (an object array of one string and 2 StringBuffers).
The Cobol program itself uses a thread-local-storage and calls several procedural sub-programs, all of which use working-storage sections.

Does anyone have a clue of what is happening here or what i am missing?
Do i have to use runtime.cobfinalize() on objects that i passed as parameters for the call?
The strange thing is that i get an UnsatisfiedLinkError when i try to call it:
java.lang.UnsatisfiedLinkError: mfcobol.runtime.cobfinalize(Ljava/lang/Object;)V

I'm not a Cobol programmer, and totally at a loss here.
Any help would be appreciated!


#netexpress
#mfcobol.jar
#cobload
#COBOL
#Java

Hi!

I have a problem that seemingly occurs when calling Cobol from Java.
Note that we still use Net Express 3.1 and the mfcobol.jar that comes with it.
We have a Java application that acts as a server and calls procedural cobol to do the business logic.
With every call to cobol, the memory usage of the process gets bigger and bigger.
I checked the java heapdumps, but i couldn't find anything suspicious there.

The called program is packaged in a dll and loaded with runtime.cobload().
The dll is linked with options shared,dynamic and multi-threaded.
All calls are done with runtime.cobcall_int(...) and the parameter types are always the same (an object array of one string and 2 StringBuffers).
The Cobol program itself uses a thread-local-storage and calls several procedural sub-programs, all of which use working-storage sections.

Does anyone have a clue of what is happening here or what i am missing?
Do i have to use runtime.cobfinalize() on objects that i passed as parameters for the call?
The strange thing is that i get an UnsatisfiedLinkError when i try to call it:
java.lang.UnsatisfiedLinkError: mfcobol.runtime.cobfinalize(Ljava/lang/Object;)V

I'm not a Cobol programmer, and totally at a loss here.
Any help would be appreciated!


#netexpress
#mfcobol.jar
#cobload
#COBOL
#Java

We, too had a memory leak in a similar situation.  Our version of NetExpress was 3.2.  We never did see anything in our code to fix it.  So we tried NetExpress 5.1 and with that version and the same code, there was no leak.


Hi!

I have a problem that seemingly occurs when calling Cobol from Java.
Note that we still use Net Express 3.1 and the mfcobol.jar that comes with it.
We have a Java application that acts as a server and calls procedural cobol to do the business logic.
With every call to cobol, the memory usage of the process gets bigger and bigger.
I checked the java heapdumps, but i couldn't find anything suspicious there.

The called program is packaged in a dll and loaded with runtime.cobload().
The dll is linked with options shared,dynamic and multi-threaded.
All calls are done with runtime.cobcall_int(...) and the parameter types are always the same (an object array of one string and 2 StringBuffers).
The Cobol program itself uses a thread-local-storage and calls several procedural sub-programs, all of which use working-storage sections.

Does anyone have a clue of what is happening here or what i am missing?
Do i have to use runtime.cobfinalize() on objects that i passed as parameters for the call?
The strange thing is that i get an UnsatisfiedLinkError when i try to call it:
java.lang.UnsatisfiedLinkError: mfcobol.runtime.cobfinalize(Ljava/lang/Object;)V

I'm not a Cobol programmer, and totally at a loss here.
Any help would be appreciated!


#netexpress
#mfcobol.jar
#cobload
#COBOL
#Java

Thanks for the reply, but for the moment iam still looking for a solution with 3.1.


Hi!

I have a problem that seemingly occurs when calling Cobol from Java.
Note that we still use Net Express 3.1 and the mfcobol.jar that comes with it.
We have a Java application that acts as a server and calls procedural cobol to do the business logic.
With every call to cobol, the memory usage of the process gets bigger and bigger.
I checked the java heapdumps, but i couldn't find anything suspicious there.

The called program is packaged in a dll and loaded with runtime.cobload().
The dll is linked with options shared,dynamic and multi-threaded.
All calls are done with runtime.cobcall_int(...) and the parameter types are always the same (an object array of one string and 2 StringBuffers).
The Cobol program itself uses a thread-local-storage and calls several procedural sub-programs, all of which use working-storage sections.

Does anyone have a clue of what is happening here or what i am missing?
Do i have to use runtime.cobfinalize() on objects that i passed as parameters for the call?
The strange thing is that i get an UnsatisfiedLinkError when i try to call it:
java.lang.UnsatisfiedLinkError: mfcobol.runtime.cobfinalize(Ljava/lang/Object;)V

I'm not a Cobol programmer, and totally at a loss here.
Any help would be appreciated!


#netexpress
#mfcobol.jar
#cobload
#COBOL
#Java

NE 3.1 Java... No Problem!

Wich Java Version?


Hi!

I have a problem that seemingly occurs when calling Cobol from Java.
Note that we still use Net Express 3.1 and the mfcobol.jar that comes with it.
We have a Java application that acts as a server and calls procedural cobol to do the business logic.
With every call to cobol, the memory usage of the process gets bigger and bigger.
I checked the java heapdumps, but i couldn't find anything suspicious there.

The called program is packaged in a dll and loaded with runtime.cobload().
The dll is linked with options shared,dynamic and multi-threaded.
All calls are done with runtime.cobcall_int(...) and the parameter types are always the same (an object array of one string and 2 StringBuffers).
The Cobol program itself uses a thread-local-storage and calls several procedural sub-programs, all of which use working-storage sections.

Does anyone have a clue of what is happening here or what i am missing?
Do i have to use runtime.cobfinalize() on objects that i passed as parameters for the call?
The strange thing is that i get an UnsatisfiedLinkError when i try to call it:
java.lang.UnsatisfiedLinkError: mfcobol.runtime.cobfinalize(Ljava/lang/Object;)V

I'm not a Cobol programmer, and totally at a loss here.
Any help would be appreciated!


#netexpress
#mfcobol.jar
#cobload
#COBOL
#Java

We are using Java 1.6 at the moment.


Hi!

I have a problem that seemingly occurs when calling Cobol from Java.
Note that we still use Net Express 3.1 and the mfcobol.jar that comes with it.
We have a Java application that acts as a server and calls procedural cobol to do the business logic.
With every call to cobol, the memory usage of the process gets bigger and bigger.
I checked the java heapdumps, but i couldn't find anything suspicious there.

The called program is packaged in a dll and loaded with runtime.cobload().
The dll is linked with options shared,dynamic and multi-threaded.
All calls are done with runtime.cobcall_int(...) and the parameter types are always the same (an object array of one string and 2 StringBuffers).
The Cobol program itself uses a thread-local-storage and calls several procedural sub-programs, all of which use working-storage sections.

Does anyone have a clue of what is happening here or what i am missing?
Do i have to use runtime.cobfinalize() on objects that i passed as parameters for the call?
The strange thing is that i get an UnsatisfiedLinkError when i try to call it:
java.lang.UnsatisfiedLinkError: mfcobol.runtime.cobfinalize(Ljava/lang/Object;)V

I'm not a Cobol programmer, and totally at a loss here.
Any help would be appreciated!


#netexpress
#mfcobol.jar
#cobload
#COBOL
#Java

Can i become a sample what is not running!?


Hi!

I have a problem that seemingly occurs when calling Cobol from Java.
Note that we still use Net Express 3.1 and the mfcobol.jar that comes with it.
We have a Java application that acts as a server and calls procedural cobol to do the business logic.
With every call to cobol, the memory usage of the process gets bigger and bigger.
I checked the java heapdumps, but i couldn't find anything suspicious there.

The called program is packaged in a dll and loaded with runtime.cobload().
The dll is linked with options shared,dynamic and multi-threaded.
All calls are done with runtime.cobcall_int(...) and the parameter types are always the same (an object array of one string and 2 StringBuffers).
The Cobol program itself uses a thread-local-storage and calls several procedural sub-programs, all of which use working-storage sections.

Does anyone have a clue of what is happening here or what i am missing?
Do i have to use runtime.cobfinalize() on objects that i passed as parameters for the call?
The strange thing is that i get an UnsatisfiedLinkError when i try to call it:
java.lang.UnsatisfiedLinkError: mfcobol.runtime.cobfinalize(Ljava/lang/Object;)V

I'm not a Cobol programmer, and totally at a loss here.
Any help would be appreciated!


#netexpress
#mfcobol.jar
#cobload
#COBOL
#Java

Here is some more Info:

All our calls from Java to Cobol are done using the old 'runtime' class in mfcobol.jar

The cobol program to be called is loaded from a dll like this:

runtime.cobload("library.dll", null);

(The folder containing the dll is set in the path variable at startup)

All the cobol-calls are done on the same cobol program using the same type of parameters like this:

runtime.cobcall_int("server", parameters);

Where 'parameters' is an Object array of one Integer and two StringBuffers.

The 'server' program in the dll looks like this:

      id division.

      program-id.   SERVER.

      thread-local-storage section.

      copy "javatypes.cpy".

      01  returnvalue                   jint.

  ... (rest of the storage section)

      linkage section.

      01  param1                 usage jint.

      01  param2                   mf-jstring.

      01  param3                 mf-jstring.

  ... (rest of the linkage section)

      procedure division           using param1

                                         param2

                                         param3

                                         .

      is4server section.

      perform

  ... (several different calls to other procedural cobol programs using the contents of the parameters)

      end-perform.

          exit program returning returnvalue.

          stop run.

The server program is compiled using the following directives: %FILENAME COBIDY(%TARGETDIR) WB3 WB CSI ANIM EDITOR(MF2) ENSUITE(3);

The dll linking options are as follows:

shared, dynamic, multi-threaded

The procedural cobol programs being called from the server all use working-storage-sections and are compiled with the same compiler directives.

With this setup i can see the memory usage of the process grow with every cobol call, while the java heap doesn't get bigger.

I have no idea how to find out where the memory allocation is happening.


Hi!

I have a problem that seemingly occurs when calling Cobol from Java.
Note that we still use Net Express 3.1 and the mfcobol.jar that comes with it.
We have a Java application that acts as a server and calls procedural cobol to do the business logic.
With every call to cobol, the memory usage of the process gets bigger and bigger.
I checked the java heapdumps, but i couldn't find anything suspicious there.

The called program is packaged in a dll and loaded with runtime.cobload().
The dll is linked with options shared,dynamic and multi-threaded.
All calls are done with runtime.cobcall_int(...) and the parameter types are always the same (an object array of one string and 2 StringBuffers).
The Cobol program itself uses a thread-local-storage and calls several procedural sub-programs, all of which use working-storage sections.

Does anyone have a clue of what is happening here or what i am missing?
Do i have to use runtime.cobfinalize() on objects that i passed as parameters for the call?
The strange thing is that i get an UnsatisfiedLinkError when i try to call it:
java.lang.UnsatisfiedLinkError: mfcobol.runtime.cobfinalize(Ljava/lang/Object;)V

I'm not a Cobol programmer, and totally at a loss here.
Any help would be appreciated!


#netexpress
#mfcobol.jar
#cobload
#COBOL
#Java

Try adding the REENTRANT"2" directive to the compile of your COBOL programs...


Hi!

I have a problem that seemingly occurs when calling Cobol from Java.
Note that we still use Net Express 3.1 and the mfcobol.jar that comes with it.
We have a Java application that acts as a server and calls procedural cobol to do the business logic.
With every call to cobol, the memory usage of the process gets bigger and bigger.
I checked the java heapdumps, but i couldn't find anything suspicious there.

The called program is packaged in a dll and loaded with runtime.cobload().
The dll is linked with options shared,dynamic and multi-threaded.
All calls are done with runtime.cobcall_int(...) and the parameter types are always the same (an object array of one string and 2 StringBuffers).
The Cobol program itself uses a thread-local-storage and calls several procedural sub-programs, all of which use working-storage sections.

Does anyone have a clue of what is happening here or what i am missing?
Do i have to use runtime.cobfinalize() on objects that i passed as parameters for the call?
The strange thing is that i get an UnsatisfiedLinkError when i try to call it:
java.lang.UnsatisfiedLinkError: mfcobol.runtime.cobfinalize(Ljava/lang/Object;)V

I'm not a Cobol programmer, and totally at a loss here.
Any help would be appreciated!


#netexpress
#mfcobol.jar
#cobload
#COBOL
#Java

Thanks Chris, but we already tried that, and strange as it sounds that doesn't seem to change anything.

The program works both with and without REENTRANT(2) but the memory problem is still the same.


Hi!

I have a problem that seemingly occurs when calling Cobol from Java.
Note that we still use Net Express 3.1 and the mfcobol.jar that comes with it.
We have a Java application that acts as a server and calls procedural cobol to do the business logic.
With every call to cobol, the memory usage of the process gets bigger and bigger.
I checked the java heapdumps, but i couldn't find anything suspicious there.

The called program is packaged in a dll and loaded with runtime.cobload().
The dll is linked with options shared,dynamic and multi-threaded.
All calls are done with runtime.cobcall_int(...) and the parameter types are always the same (an object array of one string and 2 StringBuffers).
The Cobol program itself uses a thread-local-storage and calls several procedural sub-programs, all of which use working-storage sections.

Does anyone have a clue of what is happening here or what i am missing?
Do i have to use runtime.cobfinalize() on objects that i passed as parameters for the call?
The strange thing is that i get an UnsatisfiedLinkError when i try to call it:
java.lang.UnsatisfiedLinkError: mfcobol.runtime.cobfinalize(Ljava/lang/Object;)V

I'm not a Cobol programmer, and totally at a loss here.
Any help would be appreciated!


#netexpress
#mfcobol.jar
#cobload
#COBOL
#Java

Try using the cobthreadtidy function when you are finished with the thread on which COBOL is used.

You might also look at using cobcancel?


Hi!

I have a problem that seemingly occurs when calling Cobol from Java.
Note that we still use Net Express 3.1 and the mfcobol.jar that comes with it.
We have a Java application that acts as a server and calls procedural cobol to do the business logic.
With every call to cobol, the memory usage of the process gets bigger and bigger.
I checked the java heapdumps, but i couldn't find anything suspicious there.

The called program is packaged in a dll and loaded with runtime.cobload().
The dll is linked with options shared,dynamic and multi-threaded.
All calls are done with runtime.cobcall_int(...) and the parameter types are always the same (an object array of one string and 2 StringBuffers).
The Cobol program itself uses a thread-local-storage and calls several procedural sub-programs, all of which use working-storage sections.

Does anyone have a clue of what is happening here or what i am missing?
Do i have to use runtime.cobfinalize() on objects that i passed as parameters for the call?
The strange thing is that i get an UnsatisfiedLinkError when i try to call it:
java.lang.UnsatisfiedLinkError: mfcobol.runtime.cobfinalize(Ljava/lang/Object;)V

I'm not a Cobol programmer, and totally at a loss here.
Any help would be appreciated!


#netexpress
#mfcobol.jar
#cobload
#COBOL
#Java

I think i tried that already and got errors when the next call was executed.

Also, i am pretty sure the calling thread is always the same, and is kept alive as long as the java application is running. Could this cause the problems?

I will check that again and post my findings tomorrow.


Hi!

I have a problem that seemingly occurs when calling Cobol from Java.
Note that we still use Net Express 3.1 and the mfcobol.jar that comes with it.
We have a Java application that acts as a server and calls procedural cobol to do the business logic.
With every call to cobol, the memory usage of the process gets bigger and bigger.
I checked the java heapdumps, but i couldn't find anything suspicious there.

The called program is packaged in a dll and loaded with runtime.cobload().
The dll is linked with options shared,dynamic and multi-threaded.
All calls are done with runtime.cobcall_int(...) and the parameter types are always the same (an object array of one string and 2 StringBuffers).
The Cobol program itself uses a thread-local-storage and calls several procedural sub-programs, all of which use working-storage sections.

Does anyone have a clue of what is happening here or what i am missing?
Do i have to use runtime.cobfinalize() on objects that i passed as parameters for the call?
The strange thing is that i get an UnsatisfiedLinkError when i try to call it:
java.lang.UnsatisfiedLinkError: mfcobol.runtime.cobfinalize(Ljava/lang/Object;)V

I'm not a Cobol programmer, and totally at a loss here.
Any help would be appreciated!


#netexpress
#mfcobol.jar
#cobload
#COBOL
#Java

Ok here is a little update:

Our cobol code is indeed called by the same java thread (for each client user) over and over again.

Using cobtidy or cobcancel after each call doesn't seem work for me, since all the following calls are done from the same thread (so i get an error on the second call when using cobtidy).

And cobcancel causes my cobol code to loose its "state" (the cobol code relys on stored information from previous calls).

As i said, my main cobol program uses a thread-local-storage, and the subprograms all use working-storages.

I'm gonna try and replace all working-storages with thread-local-storages and see what happens...