[jacorb-developer] PortableInterceptor and ServantLocator Together Cause Exception

McKnerney, Michael D (US SSA) michael.mcknerney at baesystems.com
Thu Jun 28 03:00:55 CEST 2012


Hi Nick,

Turns out the Jacorb is NOT processing interception point flows with ServantLocator correctly in the case of collocated calls (it does work correctly for non-collocated calls).

CORBA v3 (formal/02-06-01, etc.), section 21.3.10.2, pg 21-18 calls out the interception point flows when ServantLocator is present

-- spec --
If a POA and a servant locator are present, the order of their operations and
interception points is:
1. ServerRequestInterceptor.receive_request_service_contexts;   
2. ServantLocator.preinvoke;
3. ServerRequestInterceptor.receive_request
4. the operation
5. ServantLocator.postinvoke;
6. ServerRequestInterceptor send_reply, send_exception, or send_other.
--- end --

JacOrb has this wrong flow ordering for collocated calls

1.  tid=RequestProcessor-5,ServantLocator.preinvoke, operation=_is_a; strOid=IDL:demo/hello/GoodDay:1.0
INFO | AOM.java                 :176  | 2012-06-27 20:31:37,604 | AOM                      | add                      | tid:RequestProcessor-5 | oid: 01 02 3F 30 3F 2D 4
C 15 0A 25 10 06 30 46 38 14 14 1B 48 4C ..?0?-L..%..0F8...HL1B                                                          .object is activated
** returning servant **
INFO | entConnectionManager.java:131  | 2012-06-27 20:31:37,608 | ClientConnectionManager  | getConnection            | tid:RequestProcessor-5 | ClientConnectionManager:
 created new ClientGIOPConnection to 10.35.225.150:16250 (1ec8909)
ServerRequestInfoImpl.java, servant=demo.hello.GoodDayImpl at 4c4975
2. tid=RequestProcessor-5,receive_request_service_contexts _is_a
3. tid=RequestProcessor-5,receive_request _is_a
4. tid=RequestProcessor-5,send_reply _is_a
5. ServantLocator.postinvoke, operation=_is_a

This wrong ordering really breaks things for us, is this a hard problem to fix?

Is there a configuration setting to tell JacOrb to NOT perform collocation call optimization ?  

Thanks for helping.

take care,
-mike

-----Original Message-----
From: jacorb-developer-bounces~michael.mcknerney=baesystems.com at lists.spline.inf.fu-berlin.de [mailto:jacorb-developer-bounces~michael.mcknerney=baesystems.com at lists.spline.inf.fu-berlin.de] On Behalf Of McKnerney, Michael D (US SSA)
Sent: Wednesday, June 27, 2012 12:43 PM
To: Discussions concerning CORBA development with JacORB
Subject: Re: [jacorb-developer] PortableInterceptor and ServantLocator Together Cause Exception

Hi Nick,

Yep, that added call makes things work !

FWIW- Jacorb is the first orb I've seen that requires an explicit call to servant._this_object(orb) from within preinvoke (but I'm happy to do it :-)

I think the paragraph on pg 94-95 implies that the POA will make the _this_object(orb) call after the return from preinvoke (since the POA has an association to an ORB)
I.e.,

"A Servant may be associated with an ORB instance via one of the following means:
. . .
By returning a Servant instance from a ServantManager. The Servant returned from PortableServer::ServantActivator::incarnate() or PortableServer::ServantLocator::preinvoke() will be associated with the ORB instance that contains the POA on which the ServantManager is installed."

Thanks for the help and the quick response !

take care,
-mike

p.s. I was impressed (happy!) to see that request interceptors were called on the collocated is_a().


-----Original Message-----
From: jacorb-developer-bounces~michael.mcknerney=baesystems.com at lists.spline.inf.fu-berlin.de [mailto:jacorb-developer-bounces~michael.mcknerney=baesystems.com at lists.spline.inf.fu-berlin.de] On Behalf Of Nick Cross
Sent: Wednesday, June 27, 2012 1:02 AM
To: Discussions concerning CORBA development with JacORB
Subject: Re: [jacorb-developer] PortableInterceptor and ServantLocator Together Cause Exception


Hi,

Thanks for the command line and the source code you sent to me.

I believe you need to associate the Servant returned from the preinvoke 
with an orb instance via the _this_object method.

Regards

Nick


On 26/06/12 21:42, McKnerney, Michael D (US SSA) wrote:
> Hi Nick,
>
> Yes, the servant meets the activation condition via this case from page 95:
>
> "By returning a Servant instance from a ServantManager. The Servant returned from PortableServer::ServantActivator::incarnate() or PortableServer::ServantLocator::preinvoke() will be associated with the ORB instance that contains the POA on which the ServantManager is installed."
>
> See attached hello2.jar that demonstrates the issue.
>
> Btw- I run the demo like this:
>
> # server
> /jacorb-3.0/demo/hello2/build/classes>  jaco -cp ./:${JACORB_HOME}:${JACORB_HOME}/lib/jacorb.jar: ${JACORB_HOME}/lib/jacorb-services.jar:${JACORB_HOME}/lib/idl.jar -Dorg.omg.PortableInterceptor.ORBInitializerClass.demo.hello.MyInitializer -Djacorb.implname=hello -DOAAddress=iiop://:16250 demo.hello.Server GoodDay.ior
>
> #client
> /jacorb-3.0/demo/hello2/build/classes>  jaco -cp ./: ./:${JACORB_HOME}:${JACORB_HOME}/lib/jacorb.jar: ${JACORB_HOME}/lib/jacorb-services.jar:${JACORB_HOME}/lib/idl.jar demo.hello.Client GoodDay.ior
>
> The server output shows the same error:
>
> Jun 26, 2012 8:23:02 PM org.jacorb.orb.ORBSingleton<init>
> INFO: created ORBSingleton
> -- pre_init, orb_id=jacorb:3.0--
> Jun 26, 2012 8:23:02 PM org.jacorb.orb.giop.CodeSet getTCSDefault
> WARNING: Warning - unknown codeset (ASCII) - defaulting to ISO-8859-1
> -- post_init, orb_id=jacorb:3.0--
> Jun 26, 2012 8:23:02 PM org.jacorb.orb.portableInterceptor.InterceptorManager<init>
> INFO: InterceptorManager started with 1 Server Interceptors, 1 Client Interceptors and 1 IOR Interceptors
> Creating GoodDayImpl
> Registering strOid: IDL:demo/hello/GoodDay:1.0
> Creating DayFactoryImpl
> Registering strOid: IDL:demo/hello/DayFactory:1.0
> poa_manager.activate
> Jun 26, 2012 8:23:02 PM org.jacorb.orb.ORB run
> INFO: ORB run
> Jun 26, 2012 8:23:09 PM org.jacorb.orb.iiop.ServerIIOPConnection configure
> INFO: Opened new server-side TCP/IP transport to 10.35.225.150:41518
> tid=RequestProcessor-5,receive_request_service_contexts getDay
> tid=RequestProcessor-5,ServantLocator.preinvoke, operation=getDay; strOid=IDL:demo/hello/DayFactory:1.0
> ** returning servant **
> tid=RequestProcessor-5,receive_request getDay
> create_reference_with_id
> getDay, calling BaseHelper.narrow
> tid=RequestProcessor-5,send_request _is_a
> tid=RequestProcessor-5,ServantLocator.preinvoke, operation=_is_a; strOid=IDL:demo/hello/GoodDay:1.0
> ** returning servant **
> Jun 26, 2012 8:23:09 PM org.jacorb.orb.giop.ClientConnectionManager getConnection
> INFO: ClientConnectionManager: created new ClientGIOPConnection to 10.35.225.150:16250 (b76fa)
> Jun 26, 2012 8:23:09 PM org.jacorb.orb.Delegate servant_preinvoke
> SEVERE: unexpected exception during servant_preinvoke
> org.omg.CORBA.BAD_INV_ORDER: The Servant has not been associated with an ORBinstance
>          at org.omg.PortableServer.Servant._get_delegate(Servant.java:111)
>          at org.omg.PortableServer.Servant._poa(Servant.java:30)
>          at org.jacorb.orb.portableInterceptor.ServerRequestInfoImpl.setServant(ServerRequestInfoImpl.java:153)
>          at org.jacorb.orb.portableInterceptor.ServerRequestInfoImpl.<init>(ServerRequestInfoImpl.java:133)
>          at org.jacorb.orb.Delegate.servant_preinvoke(Delegate.java:2644)
>          at org.jacorb.orb.Delegate.is_a(Delegate.java:1789)
>          at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:53)
>          at demo.hello.BaseHelper.narrow(BaseHelper.java:59)
>          at demo.hello.DayFactoryImpl.getDay(DayFactoryImpl.java:30)
>          at demo.hello.DayFactoryPOA._invoke(DayFactoryPOA.java:58)
>          at org.jacorb.poa.RequestProcessor.invokeOperation(RequestProcessor.java:349)
>          at org.jacorb.poa.RequestProcessor.process(RequestProcessor.java:671)
>          at org.jacorb.poa.RequestProcessor.run(RequestProcessor.java:821)
> getDay, caught exception=org.omg.CORBA.BAD_INV_ORDER: The Servant has not been associated with an ORBinstance
> ServantLocator.postinvoke, operation=getDay
> tid=RequestProcessor-5,send_reply getDay
> Jun 26, 2012 8:23:09 PM org.jacorb.orb.iiop.ServerIIOPConnection close
> INFO: Closed server-side transport to 10.35.225.150:41518
>
> Thanks for the help !
>
> take care,
> mike
>
> -----Original Message-----
> From: Nick Cross [mailto:jacorb at goots.org]
> Sent: Tuesday, June 26, 2012 1:39 AM
> To: Discussions concerning CORBA development with JacORB
> Cc: McKnerney, Michael D (US SSA)
> Subject: Re: [jacorb-developer] PortableInterceptor and ServantLocator Together Cause Exception
>
>
> Hi,
>
> That error is coming from OMG supplied stub code. Could you verify that
> the conditions in the IDL to Java mapping 1.3 2008-01-11 , section
> 4.21.3, page 94/95 have been satisfied e.g. was your Servant activated
> via the POA? If it has, then supplying a sample standalone compilable
> and runnable test case would be useful.
>
> Regards
>
> Nick
>
>
> On 26/06/12 01:17, McKnerney, Michael D (US SSA) wrote:
>> Hi,
>>
>> Is it a known issue when using ServantLocator together with PortableInterceptor that this exception is always raised?
>>
>> Jun 25, 2012 10:32:17 PM org.jacorb.orb.Delegate servant_preinvoke
>> SEVERE: unexpected exception during servant_preinvoke
>> org.omg.CORBA.BAD_INV_ORDER: The Servant has not been associated with an ORBinstance
>>           at org.omg.PortableServer.Servant._get_delegate(Servant.java:111)
>>           at org.omg.PortableServer.Servant._poa(Servant.java:30)
>>           at org.jacorb.orb.portableInterceptor.ServerRequestInfoImpl.setServant(ServerRequestInfoImpl.java:153)
>>           at org.jacorb.orb.portableInterceptor.ServerRequestInfoImpl.<init>(ServerRequestInfoImpl.java:133)
>>           at org.jacorb.orb.Delegate.servant_preinvoke(Delegate.java:2644)
>>           at org.jacorb.orb.Delegate.is_a(Delegate.java:1789)
>>           at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:53)
>>           at GIAS.LibraryManagerHelper.narrow(LibraryManagerHelper.java:59)
>>           at baex.gl.gateway.gias.LibraryImpl.get_manager(LibraryImpl.java:81)
>>
>> I can post code if need be but essentially what I have is a servant (LibraryImpl) that is in the process of processing a method (get_manager) and during the processing it invokes narrow() which is handled within the same thread as the get_manager().
>>
>> If I take out the portable interceptor, all works as expected so I figure this might be a known issue?
>>
>> Thanks,
>> mike
>> _______________________________________________
>> jacorb-developer maillist  -  jacorb-developer at lists.spline.inf.fu-berlin.de
>> https://lists.spline.inf.fu-berlin.de/mailman/listinfo/jacorb-developer
>
>
>
> _______________________________________________
> jacorb-developer maillist  -  jacorb-developer at lists.spline.inf.fu-berlin.de
> https://lists.spline.inf.fu-berlin.de/mailman/listinfo/jacorb-developer

_______________________________________________
jacorb-developer maillist  -  jacorb-developer at lists.spline.inf.fu-berlin.de
https://lists.spline.inf.fu-berlin.de/mailman/listinfo/jacorb-developer
_______________________________________________
jacorb-developer maillist  -  jacorb-developer at lists.spline.inf.fu-berlin.de
https://lists.spline.inf.fu-berlin.de/mailman/listinfo/jacorb-developer


More information about the jacorb-developer mailing list