Skip to main content

Memory leak - thread handle not closed after call to CBL_DEBUGBREAK

  • February 15, 2013
  • 0 replies
  • 0 views

Problem:

A potential memory leak has been encountered in Net Express.

This was first encountered by a client running a Net Express 4.0 application that uses OpenESQL embedded SQL support to access a SQL2000 database.

They could connect to the database ok. However, when they did a large amount of accessing they eventually received the following error: Communication Link Failure.

Testing showed memory usage increase (in Windows task manager) as repeated calls to the database were made until they eventually ran out of memory - subsequently causing the error above. This only occurred in their production environment.

Resolution:

A lot of time was spent looking for leaks in the database, ODBC driver and OS etc. and making certain patch levels for these were correct.

However, it was found that a simple CALL "CBL_DEBUGBREAK" had been inadvertantly left in the COBOL program that was called for each database access. Testing showed that each time this routine was called memory usage increased until the calling process was terminated.

As soon as the CALL "CBL_DEBUGBREAK" was removed the memory leak was resolved.

This was passed to the Micro Focus development team and the found that the call-by-name routine CBL_DEBUGBREAK would cause a handle leak to occur. There was a handle leak when CBL_DEBUGBREAK executed cblcored.exe as the thread handle was not closed.

This has since been fixed and included in the scheduled Websync fix for Micro Focus Studio 5.0 Websync 2. However, this problem could still occurr in any version of Net Express prior to 5.0 Websync 2.

Although this problem manifested itself in a database access routine it could occur in any COBOL program that is called that still contains CALL "CBL_DEBUGBREAK". This should be removed for any code running in production.

Old KB# 4288