[jacorb-bugs] [Bug 960] New: ORB interception mechanism doesn't transfer ServiceContexts properly in local invocations when application interceptors raise exceptions

bugzilla-daemon at jacorb.org bugzilla-daemon at jacorb.org
Wed Jul 31 23:12:10 CEST 2013


http://www.jacorb.org/bugzilla/show_bug.cgi?id=960

            Bug ID: 960
           Summary: ORB interception mechanism doesn't transfer
                    ServiceContexts properly in local invocations when
                    application interceptors raise exceptions
           Product: JacORB
           Version: 3.1
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P5
         Component: ORB
          Assignee: jacorb-bugs at lists.spline.inf.fu-berlin.de
          Reporter: amadeu at tecgraf.puc-rio.br

Created attachment 422
  --> http://www.jacorb.org/bugzilla/attachment.cgi?id=422&action=edit
Sample code that manifest the bug

I observed a bug in org.jacorb.orb.Delegate.servant_preinvoke method when both
server and client side are the same process using the same ORB. The client
interceptors don't have access to reply ServiceContexts in receive_exception
interception point as should be (conform to CORBA spec). The problem doesn't
occur in remote invocation cenario.

I attached a sample code that manifest this bug. The mainclass
demo.InterceptorSameORBServerAndClient manifest this bug. Another classes like
demo.InterceptorServer and demo.InterceptorClient show that this bug doesn't
affect the remote cenario (when the invocation is remote). Probably when the
server side use a differente ORB than the client side the problem probably
doesn't occur also.

Explanation about my test: The demo.ServerRequestInterceptorImpl implements
receive_request and put a ServiceContext with 1234 ID in the ServerRequestInfo
and raises a NO_PERMISSION exception. After that, the
demo.ClientRequestInterceptorImpl implements receive_exception and try to get
the reply ServiceContext with 1234 ID to extract some the information that I
put there previously but I got a BAD_PARAM exception as showed in the
stacktrace:

SEVERE: unexpected exception during servant_preinvoke
org.omg.CORBA.BAD_PARAM: No ServiceContext with id 1234
    at
org.jacorb.orb.portableInterceptor.RequestInfoImpl.get_reply_service_context(RequestInfoImpl.java:192)
    at
org.jacorb.orb.portableInterceptor.ClientRequestInfoImpl.get_reply_service_context(ClientRequestInfoImpl.java:394)
    at
demo.ClientRequestInterceptorImpl.receive_exception(ClientRequestInterceptorImpl.java:26)
    at
org.jacorb.orb.portableInterceptor.ClientInterceptorIterator.invoke(ClientInterceptorIterator.java:138)
    at
org.jacorb.orb.portableInterceptor.AbstractInterceptorIterator.iterate(AbstractInterceptorIterator.java:66)
    at
org.jacorb.orb.portableInterceptor.ClientInterceptorIterator.iterate(ClientInterceptorIterator.java:87)
    at
org.jacorb.orb.DefaultClientInterceptorHandler.invokeInterceptors(DefaultClientInterceptorHandler.java:328)
    at
org.jacorb.orb.DefaultClientInterceptorHandler.handle_receive_exception(DefaultClientInterceptorHandler.java:261)
    at
org.jacorb.orb.DefaultClientInterceptorHandler.handle_receive_exception(DefaultClientInterceptorHandler.java:231)
    at org.jacorb.orb.Delegate.servant_preinvoke(Delegate.java:2755)
    at
org.omg.CORBA.portable.ObjectImpl._servant_preinvoke(ObjectImpl.java:135)
    at demo._HelloStub.sayHello(_HelloStub.java:73)
    at
demo.InterceptorSameORBServerAndClient.main(InterceptorSameORBServerAndClient.java:33)
Exception in thread "main" org.omg.CORBA.BAD_PARAM: No ServiceContext with id
1234
    at
org.jacorb.orb.portableInterceptor.RequestInfoImpl.get_reply_service_context(RequestInfoImpl.java:192)
    at
org.jacorb.orb.portableInterceptor.ClientRequestInfoImpl.get_reply_service_context(ClientRequestInfoImpl.java:394)
    at
demo.ClientRequestInterceptorImpl.receive_exception(ClientRequestInterceptorImpl.java:26)
    at
org.jacorb.orb.portableInterceptor.ClientInterceptorIterator.invoke(ClientInterceptorIterator.java:138)
    at
org.jacorb.orb.portableInterceptor.AbstractInterceptorIterator.iterate(AbstractInterceptorIterator.java:66)
    at
org.jacorb.orb.portableInterceptor.ClientInterceptorIterator.iterate(ClientInterceptorIterator.java:87)
    at
org.jacorb.orb.DefaultClientInterceptorHandler.invokeInterceptors(DefaultClientInterceptorHandler.java:328)
    at
org.jacorb.orb.DefaultClientInterceptorHandler.handle_receive_exception(DefaultClientInterceptorHandler.java:261)
    at
org.jacorb.orb.DefaultClientInterceptorHandler.handle_receive_exception(DefaultClientInterceptorHandler.java:231)
    at org.jacorb.orb.Delegate.servant_preinvoke(Delegate.java:2755)
    at
org.omg.CORBA.portable.ObjectImpl._servant_preinvoke(ObjectImpl.java:135)
    at demo._HelloStub.sayHello(_HelloStub.java:73)
    at
demo.InterceptorSameORBServerAndClient.main(InterceptorSameORBServerAndClient.java:33)

I studied the JacORB ORB code and I tried a very simple patch that seems to
resolve this issue. I'd like to ask you to analyse it:

--- jacorb-3.1-sources-upstream/src/org/jacorb/orb/Delegate.java    2012-08-19
14:26:54.000000000 -0300
+++ jacorb-3.1-sources-bugfix/src/org/jacorb/orb/Delegate.java    2013-07-30
16:05:57.000000000 -0300
@@ -2748,6 +2748,8 @@ public final class Delegate
                {
                    if (interceptors != null && orb.hasRequestInterceptors())
                    {
+                       Collection<ServiceContext> ctx =
sinfo.getReplyServiceContexts();
+                       interceptors.getInfo ().setReplyServiceContexts
(ctx.toArray (new ServiceContext[ctx.size ()]));
                        try
                        {
                            if (ex instanceof SystemException)

This bug was observed in JacORB 3.1 but it happens also in master branch code
hosted in github also. 
In master branch of github the patch is:
diff --git a/src/org/jacorb/orb/Delegate.java
b/src/org/jacorb/orb/Delegate.java
index a4b4166..3c80ffd 100644
--- a/src/org/jacorb/orb/Delegate.java
+++ b/src/org/jacorb/orb/Delegate.java
@@ -2885,6 +2885,8 @@ public final class Delegate
                     {
                         try
                         {
+                            Collection<ServiceContext> ctx =
sinfo.getReplyServiceContexts();
+                            interceptors.getInfo ().setReplyServiceContexts
(ctx.toArray (new ServiceContext[ctx.size ()]));
                             if (ex instanceof SystemException)
                             {
                                 interceptors.handle_receive_exception (
(SystemException) ex);

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spline.inf.fu-berlin.de/pipermail/jacorb-bugs/attachments/20130731/73ae709e/attachment.html>


More information about the jacorb-bugs mailing list