Problem:

Why is the CORBA Client request hangs after server ORB which uses MAIN_THREAD_MODEL policy is restarted?

Resolution:

An application may be required to ignore CORBA requests for a specific time. For example, bank services need to be taken down(paused) for an hour after midnight everyday to close up the transactions for that day.

A hang issue is encountered when the ORB, running in MAIN_THREAD_MODEL, is shut down and then restarted.

The following is the way used to pause an ORB:

1. Shutdown and restart the ORB.
- call orb->shutdown(1) and orb->destroy() to stop the ORB
2. Restart the ORB
- restart, reinitialize the ORB and call orb->run.

Hang issue debug logs:
At this point, when using the MAIN_THREAD_MODEL policy, the hang issue is observed when the orb is shut down and restarted.
RPI 1079151 has been filed to address the issue.

When the issue occurs, the debug log below is observed:
Pid# 148 Tim# Mon May 02 20:56:40 2011 817000ms Tid# 5668 Src# server Msg# Get activation record from skeleton for the poa.
Pid# 148 Tim# Mon May 02 20:56:40 2011 837000ms Tid# 5668 Src# server Msg# Servant is active and uniqueness policy is UNIQUE_ID. Returning object id of activatio rec.
Pid# 148 Tim# Mon May 02 20:56:40 2011 851000ms Tid# 5668 Src# server Msg# Servant activate. Returning reference.
Repository ID: IDL:Bank/AccountManager:1.0
 Object name: NONE
 is ready
Pid# 148 Tim# Mon May 02 20:56:40 2011 867000ms Tid# 5668 Src# se Msg# Waiting for shutdown or for main thread work to be available.
Pid# 148 Tim# Mon May 02 20:56:42 2011 308000ms Tid# 4384 Src# se Msg# MT SCM listener thread accepting new connection


Pid# 148 Tim# Mon May 02 20:56:42 2011 318000ms Tid# 4384 Src# se Msg# Accepted new connection with FD = 612.
Pid# 148 Tim# Mon May 02 20:56:42 2011 326000ms Tid# 4384 Src# connection Msg# TCP peer connection (127.0.0.1:53725), fd=612
Pid# 148 Tim# Mon May 02 20:56:42 2011 337000ms Tid# 4384 Src# se Msg# MT SCM listener thread found a read event
Pid# 148 Tim# Mon May 02 20:56:42 2011 345000ms Tid# 4384 Src# se Msg# MT SCM listener thread dispatching adapter


Workaround:
The following is a work-around for this issue:

1. Set the POA Manager to discard requests to pause the ORB and back to activated to resume the services.
- Call poa_manager->discard_requests() to make the CORBA requests for objects under the POA to ignore requests. Server will reply with CORBA::TRANSIENT exception to client requests.
- Client will need to setup QoS Rebind policies as the default VB_TRANSPARENT rebind policy will keep retrying the request at the ORB level.
- Call poa_manager->activate() to start accepting requests again

Attached test case will reproduce the issue. It has 3 modes. Check the bundled readme file for more details.
>Server [vbroker options]
modes:
      a - Use MAIN_THREAD_MODEL
      b - Use default thread model(ORB_CTRL_MODEL)
      c - Use MAIN_THREAD_MODEL POA Manager(discard_requests/activate)
                         
Mode a demonstrates the issue mentioned in point 1 with MAIN_THREAD_MODEL
Mode b demonstrates point 1 above working properly using the default ORB_CTRL_MODEL
Mode c demonstrates point 2 and showing a work-around for application running in MAIN_THREAD_MODEL
Incident #2509108