Skip to main content

Problem using Visibroker in DLLs under windows

  • February 16, 2013
  • 0 replies
  • 0 views

Problem:

  • Product Name: VisiBroker for C , PowerBuilder
  • Product Version: 6.0
  • Product Component: Core
  • Platform/OS Version: Windows

The errors are such as "The instruction at "0x029f19d3" referenced memory at "0x029f19d3". The memory could not be "read". While attempting to analyse and fix this issue, we discovered that removing the call to the following function makes the exception disappear:

void cleanupCORBA() {
  if ( bCORBAInitialized ) {
    orb->shutdown();
  }
} 

This is called during the DLL_PROCESS_DETACH action in the DllMain() method in cusmod_com_dll.cpp.

In Summary,

1) It was found that initialising the ORB when loading the DLL caused memory issues.

2) The PowerBuilder application must shutdown the orb or connections are left open until they expire.

3) By adding codes to shutdown the orb or connections that are left open, it causes memory issues problem.

Resolution:

1) Calling orb->shutdown(0) in DllMain() for DLL_PROCESS_DETACH is not appropriate.

2) A fix to the issue is to ensure orb->shutdown(1) is called before the PowerBuilder app exits and starts unloading DLLs.

3) One way of doing this is to add a "cleanup" method to the DLL's API (which means Application Program Interface) and make the PowerBuilder app call this before exiting.

4) In additional, users may call orb->shutdown() immediately following each RPC call. So each time an RPC func was requested they do an orb->init(), do the call, and then do an orb->shutdown(0). For this case, it may not avoid the problem. For example, if PowerBuilder app exits right after a RPC call. So it is not advisable to use this method.

 


#VisiBroker
#Security