fork() : rts64 : Error 96 encountered in child process

0 Likes
over 2 years ago

Symptoms

In Server Express I could use the fork() call. Now, with Visual Cobol, I encounter ‘rts64 : Error 96 encountered in child process’ failure.

 

Diagnosis

Error 96 was introduced in Visual Cobol in response to error situations which customers reported regarding thread synchronisation and deadlocks. There are, and always have been, good reasons for the limitation with fork(), and the principle has always applied – in all versions of Net Express, Server Express, and now Visual COBOL and Enterprise Developer. In practice, earlier versions such as Server Express did not trap improper uses of fork() and that appeared to work in a limited fashion, but this has become increasingly problematic over time as OS vendors tighten up over successive releases. With the latest products, it was realised that continuing the effort was not sustainable. Therefore raising the RTS 96 error early avoids a potentially long investigation on later runtime errors.

Solution

The general advice, not specific to Micro Focus, is to avoid fork() and call, but instead use fork() and exec(). As an example, refer to the Posix documentation at:

http://pubs.opengroup.org/onlinepubs/009695399/functions/fork.html

The Micro Focus documentation can be found here:

https://www.microfocus.com/documentation/visual-cobol/vc40pu8/DevHub/GUID-84954707-C2F6-4158-B83A-43DF35A28674.html

Refer to Section  'COBRT096 Invalid use of fork() (Fatal)' :

“If a process has used COBOL functionality, it can only safely call fork() if the child then safely calls one of the exec() set of APIs”.

Alternatively, the CBL_EXEC_RUN_UNIT API can be used instead to create a child process. See here:

https://www.microfocus.com/documentation/enterprise-developer/ed40pu8/ED-Eclipse/HRCLRHCALL21.html

This is a positive step in contributing to stability for customers when deploying Micro Focus Products.

Comment List
Anonymous
Related Discussions
Recommended